home *** CD-ROM | disk | FTP | other *** search
/ Developer Helper 1: Phil & Dave's Excellent CD / Excellent CD HFS.raw / Moof / DAs, INITs, CDEVs, etc / Inside Mac DA / Manual < prev    next >
Text File  |  1989-04-13  |  600KB  |  15,388 lines

  1.  ,129
  2. 129
  3. Resource Manager Definitions.
  4.  
  5. CONST
  6.       resSysHeap    = 64;   { System or application heap? }
  7.       resPurgeable  = 32;   { Purgeable resource? }
  8.       resLocked     = 16;   { Load it in locked? }
  9.       resProtected  = 8;    { Protected? }
  10.       resPreload    = 4;    { Load in on OpenResFile? }
  11.       resChanged    = 2;    { Resource changed? }
  12.  
  13.       mapReadOnly   = 128;  { Resource file read-only }
  14.       mapCompact    = 64;   { Compact resource file }
  15.       mapChanged    = 32;   { Write map out at update }
  16.  
  17.       resNotFound   = - 192; { Resource not found }
  18.       resFNotFound  = - 193; { Resource file not found }
  19.       addResFailed  = - 194; { AddResource failed }
  20.       rmvResFailed  = - 196; { RmveResource failed }
  21.       resAttrErr    = -198;  {attribute does not permit operation}
  22.       mapReadErr    = -199;  {map does not permit operation}
  23.  
  24. Resources in 128 Ko ROM:
  25.  
  26. 'CURS'  1   IBeamCursor
  27. 'CURS'  2   CrossCursor
  28. 'CURS'  3   PlusCursor
  29. 'CURS'  4   WatchCursor
  30. 'DRVR'  2   Printer Driver shell (.PRINT)
  31. 'DRVR'  3   Sound Driver  (.SOUND)
  32. 'DRVR'  4   Disk Driver  (.SONY)
  33. 'DRVR'  9   AppleTalk driver  (.MPP)
  34. 'DRVR'  A   AppleTalk driver  (.ATP)
  35. 'FONT'  0   Name of system font
  36. 'FONT'  C   System font
  37. 'MDEF'  0   Default menu definition procedure
  38. 'PACK'  4   Floating-Point Arithmetic Package
  39. 'PACK'  5   Transcendental Functions Package
  40. 'PACK'  7   Binary-Decimal Conversion Package
  41. 'SERD'  0   Serial Driver
  42. 'WDEF'  0   Default window definition function
  43.  
  44. TYPE
  45.  
  46.       ResType = PACKED ARRAY [1..4] OF CHAR;
  47.  
  48. \ ,130
  49. 130
  50. QuickDraw Definitions.
  51.  
  52. CONST
  53.       srcCopy       = 0; { the 16 transfer modes }
  54.       srcOr         = 1;
  55.       srcXor        = 2;
  56.       srcBic        = 3;
  57.       notSrcCopy    = 4;
  58.       notSrcOr      = 5;
  59.       notSrcXor     = 6;
  60.       notSrcBic     = 7;
  61.       patCopy       = 8;
  62.       patOr         = 9;
  63.       patXor        = 10;
  64.       patBic        = 11;
  65.       notPatCopy    = 12;
  66.       notPatOr      = 13;
  67.       notPatXor     = 14;
  68.       notPatBic     = 15;
  69.  
  70.       { QuickDraw color separation constants }
  71.  
  72.       normalBit     = 0; { normal screen mapping }
  73.       inverseBit    = 1; { inverse screen mapping }
  74.       redBit        = 4; { RGB additive mapping }
  75.       greenBit      = 3;
  76.       blueBit       = 2;
  77.       cyanBit       = 8; { CMYBk subtractive mapping }
  78.       magentaBit    = 7;
  79.       yellowBit     = 6;
  80.       blackBit      = 5;
  81.  
  82.       blackColor    = 33; { colors expressed in these mappings }
  83.       whiteColor    = 30;
  84.       redColor      = 205;
  85.       greenColor    = 341;
  86.       blueColor     = 409;
  87.       cyanColor     = 273;
  88.       magentaColor  = 137;
  89.       yellowColor   = 69;
  90.  
  91.       picLParen     = 0;   { standard picture comments }
  92.       picRParen     = 1;
  93.  
  94.       iBeamCursor   = 1; {text selection cursor}
  95.       crossCursor   = 2; {for drawing graphics}
  96.       plusCursor    = 3; {for structured selection}
  97.       watchCursor   = 4; {for indicating a long delay}
  98.  
  99. TYPE
  100.       QDByte = SignedByte;
  101.       QDPtr = Ptr; { blind pointer }
  102.       QDHandle = Handle; { blind handle }
  103.       Pattern = PACKED ARRAY [0..7] OF 0..255;
  104.       Bits16 = ARRAY [0..15] OF INTEGER;
  105.       VHSelect = (v, h);
  106.       GrafVerb = (frame, paint, erase, invert, fill);
  107.       StyleItem = (bold, italic, underline, outline, shadow, condense,
  108.                     extend);
  109.       Style = SET OF StyleItem;
  110.  
  111.       FontInfo = RECORD
  112.                    ascent: INTEGER;
  113.                    descent: INTEGER;
  114.                    widMax: INTEGER;
  115.                    leading: INTEGER;
  116.                  END;
  117.  
  118.       Point = RECORD
  119.                 CASE INTEGER OF
  120.  
  121.                   0:
  122.                     (v: INTEGER;
  123.                      h: INTEGER);
  124.  
  125.                   1:
  126.                     (vh: ARRAY [VHSelect] OF INTEGER);
  127.  
  128.               END;
  129.  
  130.       Rect = RECORD
  131.                CASE INTEGER OF
  132.  
  133.                  0:
  134.                    (top: INTEGER;
  135.                     left: INTEGER;
  136.                     bottom: INTEGER;
  137.                     right: INTEGER);
  138.  
  139.                  1:
  140.                    (topLeft: Point;
  141.                     botRight: Point);
  142.              END;
  143.  
  144.       BitMap = RECORD
  145.                  baseAddr: Ptr;
  146.                  rowBytes: INTEGER;
  147.                  bounds: Rect;
  148.                END;
  149.  
  150.       Cursor = RECORD
  151.                  data: Bits16;
  152.                  mask: Bits16;
  153.                  hotSpot: Point;
  154.                END;
  155.  
  156.       PenState = RECORD
  157.                    pnLoc: Point;
  158.                    pnSize: Point;
  159.                    pnMode: INTEGER;
  160.                    pnPat: Pattern;
  161.                  END;
  162.  
  163.       PolyHandle = ^PolyPtr;
  164.       PolyPtr = ^Polygon;
  165.       Polygon = RECORD
  166.                   polySize: INTEGER;
  167.                   polyBBox: Rect;
  168.                   polyPoints: ARRAY [0..0] OF Point;
  169.                 END;
  170.  
  171.       RgnHandle = ^RgnPtr;
  172.       RgnPtr = ^Region;
  173.       Region = RECORD
  174.                  rgnSize: INTEGER; { rgnSize = 10 for rectangular }
  175.                  rgnBBox: Rect;
  176.                         { plus more data if not rectangular }
  177.                END;
  178.  
  179.       PicHandle = ^PicPtr;
  180.       PicPtr = ^Picture;
  181.       Picture = RECORD
  182.                   picSize: INTEGER;
  183.                   picFrame: Rect;
  184.                           { plus byte codes for picture content }
  185.                 END;
  186.  
  187.       QDProcsPtr = ^QDProcs;
  188.       QDProcs = RECORD
  189.                   textProc: Ptr;
  190.                   lineProc: Ptr;
  191.                   rectProc: Ptr;
  192.                   rRectProc: Ptr;
  193.                   ovalProc: Ptr;
  194.                   arcProc: Ptr;
  195.                   polyProc: Ptr;
  196.                   rgnProc: Ptr;
  197.                   bitsProc: Ptr;
  198.                   commentProc: Ptr;
  199.                   txMeasProc: Ptr;
  200.                   getPicProc: Ptr;
  201.                   putPicProc: Ptr;
  202.                 END;
  203.  
  204.       GrafPtr = ^GrafPort;
  205.       GrafPort = RECORD
  206.                    device: INTEGER;
  207.                    portBits: BitMap;
  208.                    portRect: Rect;
  209.                    visRgn: RgnHandle;
  210.                    clipRgn: RgnHandle;
  211.                    bkPat: Pattern;
  212.                    fillPat: Pattern;
  213.                    pnLoc: Point;
  214.                    pnSize: Point;
  215.                    pnMode: INTEGER;
  216.                    pnPat: Pattern;
  217.                    pnVis: INTEGER;
  218.                    txFont: INTEGER;
  219.                    txFace: Style;
  220.                    txMode: INTEGER;
  221.                    txSize: INTEGER;
  222.                    spExtra: Fixed;
  223.                    fgColor: LongInt;
  224.                    bkColor: LongInt;
  225.                    colrBit: INTEGER;
  226.                    patStretch: INTEGER;
  227.                    picSave: Handle;
  228.                    rgnSave: Handle;
  229.                    polySave: Handle;
  230.                    grafProcs: QDProcsPtr;
  231.                  END;
  232.  
  233.     VAR
  234.       thePort: GrafPtr;
  235.       white: Pattern;
  236.       black: Pattern;
  237.       gray: Pattern;
  238.       ltGray: Pattern;
  239.       dkGray: Pattern;
  240.       arrow: Cursor;
  241.       screenBits: BitMap;
  242.       randSeed: LongInt;
  243.  
  244. \ ,131
  245. 131
  246. Font Manager Definitions.
  247.  
  248. CONST
  249.  
  250.       commandMark   = $11;
  251.       checkMark     = $12;
  252.       diamondMark   = $13;
  253.       appleMark     = $14;
  254.  
  255.       systemFont    = 0;
  256.       applFont      = 1;
  257.       newYork       = 2;
  258.       geneva        = 3;
  259.       monaco        = 4;
  260.       venice        = 5;
  261.       london        = 6;
  262.       athens        = 7;
  263.       sanFran       = 8;
  264.       toronto       = 9;
  265.       cairo         = 11;
  266.       losAngeles    = 12;
  267.       times         = 20;
  268.       helvetica     = 21;
  269.       courier       = 22;
  270.       symbol        = 23;
  271.       mobile        = 24;
  272.  
  273.       propFont      = $9000;
  274.       prpFntH       = $9001;
  275.       prpFntW       = $9002;
  276.       prpFntHW      = $9003;
  277.  
  278.       fixedFont     = $B000;
  279.       fxdFntH       = $B001;
  280.       fxdFntW       = $B002;
  281.       fxdFntHW      = $B003;
  282.  
  283.       fontWid       = $ACB0;
  284.  
  285. TYPE
  286.  
  287.       FMInput = PACKED RECORD
  288.                   family: INTEGER;
  289.                   size: INTEGER;
  290.                   face: Style;
  291.                   needBits: BOOLEAN;
  292.                   device: INTEGER;
  293.                   numer: Point;
  294.                   denom: Point;
  295.                 END;
  296.  
  297.       FMOutPtr = ^FMOutPut;
  298.  
  299.       FMOutPut = PACKED RECORD
  300.                    errNum: INTEGER;
  301.                    fontHandle: Handle;
  302.                    bold: Byte;
  303.                    italic: Byte;
  304.                    ulOffset: Byte;
  305.                    ulShadow: Byte;
  306.                    ulThick: Byte;
  307.                    shadow: Byte;
  308.                    extra: SignedByte;
  309.                    ascent: Byte;
  310.                    descent: Byte;
  311.                    widMax: Byte;
  312.                    leading: SignedByte;
  313.                    unused: Byte;
  314.                    numer: Point;
  315.                    denom: Point;
  316.                  END;
  317.  
  318.       FontRec = RECORD
  319.                   fontType: INTEGER;    { font type }
  320.                   firstChar: INTEGER;   { ASCII code of first character }
  321.                   lastChar: INTEGER;    { ASCII code of last character }
  322.                   widMax: INTEGER;      { maximum character width }
  323.                   kernMax: INTEGER;     { negative of maximum character kern }
  324.                   nDescent: INTEGER;    { negative of descent }
  325.                   fRectWidth: INTEGER;  { width of font rectangle }
  326.                   fRectHeight: INTEGER; { height of font rectangle }
  327.                   oWTLoc: INTEGER;      { offset to offset/width table }
  328.                   ascent: INTEGER;      { ascent }
  329.                   descent: INTEGER;     { descent }
  330.                   leading: INTEGER;     { leading }
  331.                   rowWords: INTEGER;    { row width of bit image / 2 }
  332.                 { bitImage:    ARRAY[1..rowWords,1..fRectHeight]
  333.                                     OF INTEGER;
  334.                   locTable:    ARRAY[firstChar..lastChar+2]
  335.                                     OF INTEGER;
  336.                   owTable:    ARRAY[firstChar..lastChar+2]
  337.                                     OF INTEGER;
  338.                   widthTable: ARRAY[firstChar..lastChar+2]
  339.                                     OF INTEGER;
  340.                   heightTable: ARRAY[firstChar..lastChar+2]
  341.                                     OF INTEGER; }
  342.                 END;
  343.  
  344.       {new 128K ROM}
  345.  
  346.       FMetricRec = RECORD
  347.                      ascent: Fixed;     {base line to top}
  348.                      descent: Fixed;    {base line to bottom}
  349.                      leading: Fixed;    {leading between lines}
  350.                      widMax: Fixed;     {maximum character width}
  351.                      wTabHandle: Fixed; {handle to font width table}
  352.                    END;
  353.  
  354.       WidTable = RECORD
  355.                    numWidths: INTEGER; {number of entries - 1}
  356.                             {widList: ARRAY[1..numWidths] of WidEntry}
  357.                  END;
  358.  
  359.       WidEntry = RECORD
  360.                    widStyle: INTEGER; {style entry applies to}
  361.                                       {widRec: ARRAY[firstChar..lastChar]
  362.                                         of INTEGER}
  363.                  END;
  364.  
  365.       AsscEntry = RECORD
  366.                     fontSize: INTEGER;
  367.                     fontStyle: INTEGER;
  368.                     fontID: INTEGER; {font resource ID}
  369.                   END;
  370.  
  371.       FontAssoc = RECORD
  372.                     numAssoc: INTEGER; {number of entries - 1}
  373.                             {asscTable: ARRAY[1..numAssoc] OF AsscEntry}
  374.                   END;
  375.  
  376.       StyleTable = RECORD
  377.                      fontClass: INTEGER;
  378.                      offset: LongInt;
  379.                      reserved: LongInt;
  380.                      indexes: ARRAY [0..47] OF Byte;
  381.                    END;
  382.  
  383.       NameTable = RECORD
  384.                     stringCount: INTEGER;
  385.                     baseFontName: STR255;
  386.                                 {strings: ARRAY[2..stringCount]  OF STRING}
  387.                                 {the lengths of the strings are arbitrary}
  388.                   END;
  389.  
  390.       KernPair = RECORD
  391.                    kernFirst: CHAR; {1st character of kerned pair}
  392.                    kernSecond: CHAR; {2nd character of kerned pair}
  393.                    kernWidth: INTEGER; {kerning in 1pt fixed format}
  394.                  END;
  395.  
  396.       KernEntry = RECORD
  397.                     kernLength: INTEGER; {length of this entry}
  398.                     kernStyle: INTEGER; {style the entry applies to}
  399.                              {kernRec: ARRAY[1..(kernLength/4)-1] OF KernPair}
  400.                   END;
  401.  
  402.       KernTable = RECORD
  403.                     numKerns: INTEGER; {number of kerning entries}
  404.                             {kernList: ARRAY[1..numKerns] OF KernEntry}
  405.                   END;
  406.  
  407.       WidthTable = PACKED RECORD
  408.                      tabData: ARRAY [1..256] OF Fixed; {character widths}
  409.                      tabFont: Handle; {font record used to build table}
  410.                      sExtra: LongInt; {space extra used for table}
  411.                      Style: LongInt; {extra due to style}
  412.                      fID: INTEGER; {font family ID}
  413.                      fSize: INTEGER; {font size request}
  414.                      face: INTEGER; {style (face) request}
  415.                      device: INTEGER; {device requested}
  416.                      vInScale: Fixed; {scale factors requested}
  417.                      hInScale: Fixed; {scale factors requested}
  418.                      aFID: INTEGER; {actual font family ID for table}
  419.                      fHand: Handle; {family record used to build up table}
  420.                      usedFam: BOOLEAN; {used fixed point family widths}
  421.                      aFace: Byte; {actual face produced}
  422.                      vOutput: INTEGER; {vertical scale output value}
  423.                      hOutput: INTEGER; {horizontal scale output value}
  424.                      vFactor: INTEGER; {vertical scale output value}
  425.                      hFactor: INTEGER; {horizontal scale output value}
  426.                      aSize: INTEGER; {actual size of actual font used}
  427.                      tabSize: INTEGER; {total size of table}
  428.                    END;
  429.  
  430.       FamRec = RECORD
  431.                  ffFlags: INTEGER; {flags for family}
  432.                  ffFamID: INTEGER; {family ID number}
  433.                  ffFirstChar: INTEGER; {ASCII code of 1st character}
  434.                  ffLastChar: INTEGER; {ASCII code of last character}
  435.                  ffAscent: INTEGER; {maximum ascent for 1pt font}
  436.                  ffDescent: INTEGER; {maximum descent for 1pt font}
  437.                  ffLeading: INTEGER; {maximum leading for 1pt font}
  438.                  ffWidMax: INTEGER; {maximum widMax for 1pt font}
  439.                  ffWTabOff: LongInt; {offset to width table}
  440.                  ffKernOff: LongInt; {offset to kerning table}
  441.                  ffStylOff: LongInt; {offset to style mapping table}
  442.                  ffProperty: ARRAY [1..9] OF INTEGER; {style property info}
  443.                  ffIntl: ARRAY [1..2] OF INTEGER; {for international use}
  444.                  ffVersion: INTEGER; {version number}
  445.                           {ffAssoc:    FontAssoc;} {font association table}
  446.                           {ffWidthTab: WidTable;} {width table}
  447.                           {ffStyTab:   StyleTable;} {style mapping table}
  448.                           {ffKernTab:  KernTable;} {kerning table}
  449.                END;
  450.  
  451. \ ,132
  452. 132
  453. Event Manager Definitions.
  454.  
  455. CONST
  456.  
  457.       everyEvent    = - 1;
  458.       NullEvent     = 0;
  459.       mouseDown     = 1;
  460.       mouseUp       = 2;
  461.       keyDown       = 3;
  462.       keyUp         = 4;
  463.       autoKey       = 5;
  464.       updateEvt     = 6;
  465.       diskEvt       = 7;
  466.       activateEvt   = 8;
  467.       networkEvt    = 10;
  468.       driverEvt     = 11;
  469.       app1Evt       = 12;
  470.       app2Evt       = 13;
  471.       app3Evt       = 14;
  472.       app4Evt       = 15;
  473.  
  474.       { event mask equates }
  475.       mDownMask     = 2;
  476.       mUpMask       = 4;
  477.       keyDownMask   = 8;
  478.       keyUpMask     = 16;
  479.       autoKeyMask   = 32;
  480.       updateMask    = 64;
  481.       diskMask      = 128;
  482.       activMask     = 256;
  483.       networkMask   = 1024;
  484.       driverMask    = 2048;
  485.       app1Mask      = 4096;
  486.       app2Mask      = 8192;
  487.       app3Mask      = 16384;
  488.       app4Mask      = - 32768;
  489.  
  490.       {to decipher event message for keyDown events}
  491.       charCodeMask  = $000000FF;
  492.       keyCodeMask   = $0000FF00;
  493.  
  494.       { modifiers }
  495.       optionKey     = 2048; { Bit 3 of high byte }
  496.       alphaLock     = 1024; { Bit 2 }
  497.       ShiftKey      = 512;  { Bit 1 }
  498.       CmdKey        = 256;  { Bit 0 }
  499.       BtnState      = 128;  { Bit 7 of low byte is mouse button state }
  500.  
  501.       activeFlag    = 1;    { bit 0 of modifiers for activate event }
  502.  
  503.       {error for PostEvent}
  504.       EvtNotEnb     = 1;
  505.  
  506. TYPE
  507.  
  508.       EventRecord = RECORD
  509.                       what: INTEGER;
  510.                       message: LongInt;
  511.                       when: LongInt;
  512.                       where: Point;
  513.                       modifiers: INTEGER;
  514.                     END;
  515.  
  516.       KeyMap = PACKED ARRAY [0..127] OF BOOLEAN;
  517.  
  518. \ ,133
  519. 133
  520. Window Manager Definitions.
  521.  
  522. CONST
  523.  
  524.       {window messages}
  525.       wDraw     = 0;
  526.       wHit      = 1;
  527.       wCalcRgns = 2;
  528.       wNew      = 3;
  529.       wDispose  = 4;
  530.       wGrow     = 5;
  531.       wDrawGIcon = 6;
  532.  
  533.       {types of windows}
  534.       dialogKind    = 2;
  535.       userKind      = 8;
  536.  
  537.       {desk pattern resource ID}
  538.       deskPatID     = 16;
  539.  
  540.       {window definition procedure IDs}
  541.       documentProc  = 0;
  542.       dBoxProc      = 1;
  543.       plainDBox     = 2;
  544.       altDBoxProc   = 3;
  545.       noGrowDocProc = 4;
  546.       zoomDocProc   = 8;
  547.       zoomNoGrow    = 12;
  548.       rDocProc      = 16;
  549.  
  550.       {FindWindow Result Codes}
  551.       inDesk        = 0;
  552.       inMenuBar     = 1;
  553.       inSysWindow   = 2;
  554.       inContent     = 3;
  555.       inDrag        = 4;
  556.       inGrow        = 5;
  557.       inGoAway      = 6;
  558.  
  559.       {new 128K ROM}
  560.       inZoomIn      = 7;
  561.       inZoomOut     = 8;
  562.  
  563.       {defProc hit test codes}
  564.       wNoHit        = 0;
  565.       wInContent    = 1;
  566.       wInDrag       = 2;
  567.       wInGrow       = 3;
  568.       wInGoAway     = 4;
  569.  
  570.       {new 128K ROM}
  571.       wInZoomIn     = 5;
  572.       wInZoomOut    = 6;
  573.  
  574.       {axis constraints for DragGrayRgn call}
  575.       noConstraint  = 0;
  576.       hAxisOnly     = 1;
  577.       vAxisOnly     = 2;
  578.  
  579. TYPE
  580.  
  581.       WindowPtr     = GrafPtr;
  582.       WindowPeek    = ^WindowRecord;
  583.       ControlHandle = ^ControlPtr; {for Control Manager}
  584.  
  585.       WStateData =  RECORD;
  586.         userState:  Rect;   {user state}
  587.         stdState:   Rect    {standard state}
  588.       END;
  589.  
  590.       WindowRecord = RECORD
  591.                        port: GrafPort;
  592.                        windowKind: INTEGER;
  593.                        visible: BOOLEAN;
  594.                        hilited: BOOLEAN;
  595.                        goAwayFlag: BOOLEAN;
  596.                        spareFlag: BOOLEAN;
  597.                        strucRgn: RgnHandle;
  598.                        contRgn: RgnHandle;
  599.                        updateRgn: RgnHandle;
  600.                        windowDefProc: Handle;
  601.                        dataHandle: Handle;
  602.                        titleHandle: StringHandle;
  603.                        titleWidth: INTEGER;
  604.                        ControlList: ControlHandle;
  605.                        nextWindow: WindowPeek;
  606.                        windowPic: PicHandle;
  607.                        refCon: LongInt;
  608.                      END;
  609.  
  610. \ ,134
  611. 134
  612. Control Manager Definitions.
  613.  
  614. CONST
  615.  
  616.       {control messages}
  617.       drawCntl  = 0;
  618.       testCntl  = 1;
  619.       calcCRgns = 2;
  620.       initCntl  = 3;
  621.       dispCntl  = 4;
  622.       posCntl   = 5;
  623.       thumbCntl = 6;
  624.       dragCntl  = 7;
  625.       autoTrack = 8;
  626.  
  627.       {FindControl Result Codes}
  628.       inButton      = 10;
  629.       inCheckbox    = 11;
  630.       inUpButton    = 20;
  631.       inDownButton  = 21;
  632.       inPageUp      = 22;
  633.       inPageDown    = 23;
  634.       inThumb       = 129;
  635.  
  636.       {control definition proc ID's}
  637.       pushButProc   = 0;
  638.       checkBoxProc  = 1;
  639.       radioButProc  = 2;
  640.       scrollBarProc = 16;
  641.  
  642.       useWFont      = 8;
  643.  
  644. TYPE
  645.       ControlPtr = ^ControlRecord;
  646.  
  647.       ControlRecord = PACKED RECORD
  648.                         nextControl: ControlHandle;
  649.                         contrlOwner: WindowPtr;
  650.                         contrlRect: Rect;
  651.                         contrlVis: Byte;
  652.                         contrlHilite: Byte;
  653.                         contrlValue: INTEGER;
  654.                         contrlMin: INTEGER;
  655.                         contrlMax: INTEGER;
  656.                         contrlDefProc: Handle;
  657.                         contrlData: Handle;
  658.                         contrlAction: ProcPtr;
  659.                         contrlrfCon: LongInt;
  660.                         contrlTitle: STR255;
  661.                       END; {ControlRecord}
  662.  
  663.  
  664. \ ,135
  665. 135
  666. Menu Manager Definitions.
  667.  
  668. CONST
  669.       noMark        = 0; { mark symbol for MarkItem }
  670.       TextMenuProc  = 0;
  671.  
  672.       { menu defProc messages }
  673.       mDrawMsg      = 0;
  674.       mChooseMsg    = 1;
  675.       mSizeMsg      = 2;
  676.  
  677. TYPE
  678.       MenuPtr       = ^MenuInfo;
  679.       MenuHandle    = ^MenuPtr;
  680.       MenuInfo      = RECORD
  681.                        menuId: INTEGER;
  682.                        menuWidth: INTEGER;
  683.                        menuHeight: INTEGER;
  684.                        menuProc: Handle;
  685.                        enableFlags: LongInt;
  686.                        menuData: STR255;
  687.                      END;
  688.  
  689. \ ,136
  690. 136
  691. TextEdit Definitions.
  692.  
  693. CONST
  694.       teJustLeft    = 0;
  695.       teJustRight   = - 1;
  696.       teJustCenter  = 1;
  697.  
  698. TYPE
  699.       TERec = RECORD
  700.                 destRect: Rect;         {Destination rectangle}
  701.                 viewRect: Rect;         {view rectangle}
  702.                 selRect: Rect;          {Select rectangle}
  703.                 lineHeight: INTEGER;    {Current font lineheight}
  704.                 fontAscent: INTEGER;    {Current font ascent}
  705.                 selPoint: Point;        {Selection point(mouseLoc)}
  706.  
  707.                 selStart: INTEGER;      {Selection start}
  708.                 selEnd: INTEGER;        {Selection end}
  709.  
  710.                 active: INTEGER;        {<>0 if active}
  711.  
  712.                 wordBreak: ProcPtr;     {Word break routine}
  713.                 clikLoop: ProcPtr;      {Click loop routine}
  714.  
  715.                 clickTime: LongInt;     {Time of first click}
  716.                 clickLoc: INTEGER;      {Char. location of click}
  717.  
  718.                 caretTime: LongInt;     {Time for next caret blink}
  719.                 caretState: INTEGER;    {On/active booleans}
  720.  
  721.                 just: INTEGER;          {fill style}
  722.  
  723.                 teLength: INTEGER;      {Length of text below}
  724.                 hText: Handle;          {Handle to actual text}
  725.  
  726.                 recalBack: INTEGER;     {<>0 if recal in background}
  727.                 recalLines: INTEGER;    {Line being recal'ed}
  728.                 clikStuff: INTEGER;     {click stuff (internal)}
  729.  
  730.                 crOnly: INTEGER;        {Set to -1 if CR line breaks only}
  731.  
  732.                 txFont: INTEGER;        {Text Font}
  733.                 txFace: Style;          {Text Face}
  734.                 txMode: INTEGER;        {Text Mode}
  735.                 txSize: INTEGER;        {Text Size}
  736.  
  737.                 inPort: GrafPtr;        {Grafport}
  738.  
  739.                 highHook: ProcPtr;      {Highlighting hook}
  740.                 caretHook: ProcPtr;     {Highlighting hook}
  741.  
  742.                 nLines: INTEGER;        {Number of lines}
  743.                 lineStarts: ARRAY [0..16000] OF INTEGER;
  744.                                         {Actual line starts
  745.                                         themselves}
  746.               END;                      {RECORD}
  747.       TEPtr = ^TERec;
  748.       TEHandle = ^TEPtr;
  749.  
  750.       CharsHandle = ^CharsPtr;
  751.       CharsPtr = ^Chars;
  752.       Chars = PACKED ARRAY [0..32000] OF CHAR;
  753.  
  754. \ ,137
  755. 137
  756. Dialog Manager Definitions.
  757.  
  758. CONST
  759.       userItem  = 0;
  760.       ctrlItem  = 4;
  761.       btnCtrl   = 0;    { Low two bits specify what kind of control }
  762.       chkCtrl   = 1;
  763.       radCtrl   = 2;
  764.       resCtrl   = 3;
  765.  
  766.       statText      = 8;        { Static text }
  767.       editText      = 16;       { Editable text }
  768.       iconItem      = 32;       { Icon item }
  769.       picItem       = 64;       { Picture item }
  770.       itemDisable   = 128;      { Disable item if set }
  771.  
  772.       ok        = 1;        { OK button is first by convention }
  773.       cancel    = 2;        { Cancel button is second by convention }
  774.  
  775.       stopIcon      = 0;
  776.       noteIcon      = 1;
  777.       cautionIcon   = 2;
  778.  
  779. TYPE
  780.       DialogPtr    = WindowPtr;
  781.       DialogPeek   = ^DialogRecord;
  782.       DialogRecord = RECORD
  783.                        window: WindowRecord;
  784.                        Items: Handle;
  785.                        textH: TEHandle;
  786.                        editField: INTEGER;
  787.                        editOpen: INTEGER;
  788.                        aDefItem: INTEGER;
  789.                      END;
  790.  
  791.       DialogTHndl = ^DialogTPtr;
  792.       DialogTPtr = ^DialogTemplate;
  793.       DialogTemplate = RECORD
  794.                          boundsRect: Rect;
  795.                          procID: INTEGER;
  796.                          visible: BOOLEAN;
  797.                          filler1: BOOLEAN;
  798.                          goAwayFlag: BOOLEAN;
  799.                          filler2: BOOLEAN;
  800.                          refCon: LongInt;
  801.                          ItemsID: INTEGER;
  802.                          title: STR255;
  803.                        END;
  804.  
  805.       StageList = PACKED RECORD
  806.                     boldItm4: 0..1;
  807.                     boxDrwn4: BOOLEAN;
  808.                     sound4: 0..3;
  809.                     boldItm3: 0..1;
  810.                     boxDrwn3: BOOLEAN;
  811.                     sound3: 0..3;
  812.                     boldItm2: 0..1;
  813.                     boxDrwn2: BOOLEAN;
  814.                     sound2: 0..3;
  815.                     boldItm1: 0..1;
  816.                     boxDrwn1: BOOLEAN;
  817.                     sound1: 0..3;
  818.                   END;
  819.  
  820.       AlertTHndl = ^AlertTPtr;
  821.       AlertTPtr = ^AlertTemplate;
  822.       AlertTemplate = RECORD
  823.                         boundsRect: Rect;
  824.                         ItemsID: INTEGER;
  825.                         stages: StageList;
  826.                       END;
  827.  
  828. \ ,138
  829. 138
  830. Desk Manager Definitions.
  831.  
  832. CONST (Assembly-Language)
  833.  
  834. drvrFlags       EQU  $0     ; various flags and permissions [word]
  835. drvrDelay       EQU  $2     ; # of ticks between systask calls [word]
  836. drvrEMask       EQU  $4     ; event mask [word]
  837. drvrMenu        EQU  $6     ; driver menu ID [word]
  838. drvrOpen        EQU  $8     ; open routine offset [word]
  839. drvrPrime       EQU  $A     ; prime routine offset [word]
  840. drvrCtl         EQU  $C     ; control routine offset [word]
  841. drvrStatus      EQU  $E     ; status routine offset [word]
  842. drvrClose       EQU  $10    ; warmstart reset routine offset [word]
  843. drvrName        EQU  $12    ; length byte and name of driver [string]
  844.  
  845. accEvent        EQU  $40    ; event message from SystemEvent
  846. accRun          EQU  $41    ; run message from SystemTask
  847. accCursor       EQU  $42    ; cursor message from SystemTask
  848. accMenu         EQU  $43    ; menu message from SystemMenu
  849. accUndo         EQU  $44    ; undo message from SystemEdit
  850. accCut          EQU  $46    ; cut message from SystemEdit
  851. accCopy         EQU  $47    ; copy message from SystemEdit
  852. accPaste        EQU  $48    ; paste message from SystemEdit
  853. accClear        EQU  $49    ; clear message from SystemEdit
  854.  
  855. goodBye         EQU  -1     ; goodbye message
  856.  
  857. \ ,139
  858. 139
  859. Scrap Manager Definitions.
  860.  
  861. CONST
  862.       noScrapErr    = - 100; {desk scrap isn't initialized}
  863.       noTypeErr     = - 102;
  864.  
  865. TYPE
  866.       ScrapStuff = RECORD
  867.                      scrapSize: LongInt;
  868.                      scrapHandle: Handle;
  869.                      scrapCount: INTEGER;
  870.                      scrapState: INTEGER;
  871.                      scrapName: StringPtr;
  872.                    END;
  873.       pScrapStuff = ^ScrapStuff;
  874.  
  875. \ ,140
  876. 140
  877. Toolbox Utilities Definitions.
  878.  
  879. CONST
  880.       sysPatListID  = 0;    {ID of PAT# which contains 38 patterns}
  881.  
  882.       iBeamCursor   = 1;    {text selection cursor}
  883.       crossCursor   = 2;    {for drawing graphics}
  884.       plusCursor    = 3;    {for structured selection}
  885.       watchCursor   = 4;    {for indicating a long delay}
  886.  
  887. TYPE
  888.       Int64Bit = RECORD
  889.                    hiLong: LongInt;
  890.                    loLong: LongInt;
  891.                  END;
  892.  
  893.       CursPtr = ^Cursor;
  894.       CursHandle = ^CursPtr;
  895.  
  896.       PatPtr = ^Pattern;
  897.       PatHandle = ^PatPtr;
  898.  
  899. \ ,141
  900. 141
  901. Package Manager Definitions.
  902.  
  903. CONST
  904.       listMgr   = 0; {list manager}
  905.       dskInit   = 2; {Disk Initializaton}
  906.       stdFile   = 3; {Standard File}
  907.       flPoint   = 4; {Floating-Point Arithmetic}
  908.       trFunc    = 5; {Transcendental Functions}
  909.       intUtil   = 6; {International Utilities}
  910.       bdConv    = 7; {Binary/Decimal Conversion}
  911.  
  912. \ ,142
  913. 142
  914. Memory Manager Definition.
  915.  
  916. CONST
  917.   MemFullErr    = - 108; { Not enough room in heap zone }
  918.   NilHandleErr  = - 109; { Master Pointer was NIL in HandleZone or other }
  919.   MemWZErr      = - 111; { WhichZone failed (applied to free block) }
  920.   MemPurErr     = - 112; { trying to purge a locked or non-purgeable block }
  921.   MemLockedErr  = - 117; { Block is locked }
  922.   NoErr         = 0;     { All is well }
  923.  
  924. TYPE
  925.       SignedByte    = - 128..127;   { any byte in memory }
  926.       Byte          = 0..255;       { unsigned byte for fontmgr }
  927.       Ptr           = ^SignedByte;  { blind pointer }
  928.       Handle        = ^Ptr;         { pointer to a master pointer }
  929.       ProcPtr       = Ptr;          { pointer to a procedure }
  930.       Fixed         = LongInt;      { fixed point arithmetic type }
  931.  
  932.       Str255        = String[255];  { maximum string size }
  933.       StringPtr     = ^Str255;      { pointer to maximum string }
  934.       StringHandle  = ^StringPtr;   { handle to maximum string }
  935.  
  936.       Zone = RECORD
  937.                BkLim: Ptr;
  938.                PurgePtr: Ptr;
  939.                HFstFree: Ptr;
  940.                ZCBFree: LongInt;
  941.                GZProc: ProcPtr;
  942.                MoreMast: INTEGER;
  943.                Flags: INTEGER;
  944.                CntRel: INTEGER;
  945.                MaxRel: INTEGER;
  946.                CntNRel: INTEGER;
  947.                MaxNRel: INTEGER;
  948.                CntEmpty: INTEGER;
  949.                CntHandles: INTEGER;
  950.                MinCBFree: LongInt;
  951.                PurgeProc: ProcPtr;
  952.                SparePtr: Ptr;       { reserved for future }
  953.                AllocPtr: Ptr;
  954.                HeapData: INTEGER;
  955.              END;
  956.       THz   = ^Zone;    { pointer to the start of a heap zone }
  957.       Size  = LongInt;  { size of a block in bytes }
  958.       OSErr = INTEGER;  { error code }
  959.  
  960.       QElemPtr = ^QElem; {ptr to generic queue element}
  961.  
  962. \ ,143
  963. 143
  964. Segment Loader Definitions.
  965.  
  966. CONST
  967.       appOpen  = 0 ;  { Open the Document (s) }
  968.       appPrint = 1 ;  { Print the Document (s)}
  969. TYPE
  970.       appFile = RECORD
  971.                   vRefNum: INTEGER;
  972.                   ftype: OSType;
  973.                   versNum: INTEGER; {versNum in high byte}
  974.                   fName: str255;
  975.                 END; {appFile}
  976.  
  977. \ ,144
  978. 144
  979. OS Event Definitions.
  980.  
  981. CONST
  982.       NullEvent     = 0;
  983.       mouseDown     = 1;
  984.       mouseUp       = 2;
  985.       keyDown       = 3;
  986.       keyUp         = 4;
  987.       autoKey       = 5;
  988.       updateEvt     = 6;
  989.       diskEvt       = 7;
  990.       activateEvt   = 8;
  991.       networkEvt    = 10;
  992.       driverEvt     = 11;
  993.       app1Evt       = 12;
  994.       app2Evt       = 13;
  995.       app3Evt       = 14;
  996.       app4Evt       = 15;
  997.  
  998.       { event mask equates }
  999.       mDownMask     = 2;
  1000.       mUpMask       = 4;
  1001.       keyDownMask   = 8;
  1002.       keyUpMask     = 16;
  1003.       autoKeyMask   = 32;
  1004.       updateMask    = 64;
  1005.       diskMask      = 128;
  1006.       activMask     = 256;
  1007.       networkMask   = 1024;
  1008.       driverMask    = 2048;
  1009.       app1Mask      = 4096;
  1010.       app2Mask      = 8192;
  1011.       app3Mask      = 16384;
  1012.       app4Mask      = - 32768;
  1013.  
  1014.       {to decipher event message for keyDown events}
  1015.       charCodeMask  = $000000FF;
  1016.       keyCodeMask   = $0000FF00;
  1017.  
  1018.       { modifiers }
  1019.       optionKey     = 2048; { Bit 3 of high byte }
  1020.       alphaLock     = 1024; { Bit 2 }
  1021.       ShiftKey      = 512;  { Bit 1 }
  1022.       CmdKey        = 256;  { Bit 0 }
  1023.       BtnState      = 128;  { Bit 7 of low byte is mouse button state }
  1024.  
  1025.       activeFlag    = 1;    { bit 0 of modifiers for activate event }
  1026.  
  1027.       {error for PostEvent}
  1028.       EvtNotEnb     = 1;
  1029.  
  1030. TYPE
  1031.       EventRecord = RECORD
  1032.                       what: INTEGER;
  1033.                       message: LongInt;
  1034.                       when: LongInt;
  1035.                       where: Point;
  1036.                       modifiers: INTEGER;
  1037.                     END;
  1038.  
  1039.       evQEl = RECORD
  1040.                 qLink: QElemPtr;
  1041.                 qType: INTEGER;
  1042.                 evtQwhat: INTEGER; {this part is identical to the EventRecord
  1043.                                     as...}
  1044.                 evtQmessage: LongInt; {defined in ToolIntf}
  1045.                 evtQwhen: LongInt;
  1046.                 evtQwhere: Point;
  1047.                 evtQmodifiers: INTEGER;
  1048.               END;
  1049.  
  1050. \ ,145
  1051. 145
  1052. File Manager Definitions.
  1053.  
  1054. CONST
  1055.   DirFulErr     = - 33; { Directory full }
  1056.   DskFulErr     = - 34; { disk full }
  1057.   NSVErr        = - 35; { no such volume }
  1058.   IOErr         = - 36; { I/O error }
  1059.   BdNamErr      = - 37; { bad name }
  1060.   FNOpnErr      = - 38; { File not open }
  1061.   EOFErr        = - 39; { End of file }
  1062.   PosErr        = - 40; { tried to position to before start of file (r/w) }
  1063.   MFulErr       = - 41; { memory full(open) or file won't fit (load) }
  1064.   TMFOErr       = - 42; { too many files open }
  1065.   FNFErr        = - 43; { File not found }
  1066.  
  1067.   WPrErr        = - 44; { diskette is write protected }
  1068.   FLckdErr      = - 45; { file is locked }
  1069.   VLckdErr      = - 46; { volume is locked }
  1070.   FBsyErr       = - 47; { File is busy (delete) }
  1071.   DupFNErr      = - 48; { duplicate filename (rename) }
  1072.   OpWrErr       = - 49; { file already open with with write permission }
  1073.   ParamErr      = - 50; { error in user parameter list }
  1074.   RFNumErr      = - 51; { refnum error }
  1075.   GFPErr        = - 52; { get file position error }
  1076.   VolOffLinErr  = - 53; { volume not on line error (was Ejected) }
  1077.   PermErr       = - 54; { permissions error (on file open) }
  1078.   VolOnLinErr   = - 55; { drive volume already on-line at MountVol }
  1079.   NSDrvErr      = - 56; { no such drive (tried to mount a bad drive num) }
  1080.   NoMacDskErr   = - 57; { not a mac diskette (sig bytes are wrong) }
  1081.   ExtFSErr      = - 58; { volume in question belongs to an external fs }
  1082.   FSRnErr       = - 59; { file system rename error }
  1083.   BadMDBErr     = - 60; { bad master directory block }
  1084.   WrPermErr     = - 61; { write permissions error }
  1085.  
  1086.   lastDskErr    = - 64; { last in a range of disk errors }
  1087.   noDriveErr    = - 64; { drive not installed }
  1088.   offLinErr     = - 65; { r/w requested for an off-line drive }
  1089.   noNybErr      = - 66; { couldn't find 5 nybbles in 200 tries }
  1090.   noAdrMkErr    = - 67; { couldn't find valid addr mark }
  1091.   dataVerErr    = - 68; { read verify compare failed }
  1092.   badCkSmErr    = - 69; { addr mark checksum didn't check }
  1093.   badBtSlpErr   = - 70; { bad addr mark bit slip nibbles }
  1094.   noDtaMkErr    = - 71; { couldn't find a data mark header }
  1095.   badDCkSum     = - 72; { bad data mark checksum }
  1096.   badDBtSlp     = - 73; { bad data mark bit slip nibbles }
  1097.   wrUnderRun    = - 74; { write underrun occurred }
  1098.   cantStepErr   = - 75; { step handshake failed }
  1099.   tk0BadErr     = - 76; { track 0 detect doesn't change }
  1100.   initIWMErr    = - 77; { unable to initialize IWM }
  1101.   twoSideErr    = - 78; { tried to read 2nd side on a 1-sided drive }
  1102.   spdAdjErr     = - 79; { unable to correctly adjust disk speed }
  1103.   seekErr       = - 80; { track number wrong on address mark }
  1104.   sectNFErr     = - 81; { sector number never found on a track }
  1105.   firstDskErr   = - 84; { first in a range of disk errors }
  1106.  
  1107.   DirNFErr      = - 120; { Directory not found }
  1108.   TMWDOErr      = - 121; { No free WDCB available }
  1109.   BadMovErr     = - 122; { Move into offspring error }
  1110.   WrgVolTypErr  = - 123; { Wrong volume type error - operation not
  1111.                             supported for MFS}
  1112.   FSDSIntErr    = - 127; { Internal file system error }
  1113.  
  1114.   MaxSize       = $800000; { Max data block size is 8 megabytes }
  1115.  
  1116.       {finder constants}
  1117.       fOnDesk       = 1;
  1118.       fHasBundle    = 8192;
  1119.       fInvisible    = 16384;
  1120.       fTrash        = - 3;
  1121.       fDesktop      = - 2;
  1122.       fDisk         = 0;
  1123.  
  1124.       {io constants}
  1125.  
  1126.       {ioPosMode values}
  1127.       fsAtMark      = 0;
  1128.       fsFromStart   = 1;
  1129.       fsFromLEOF    = 2;
  1130.       fsFromMark    = 3;
  1131.       rdVerify      = 64;
  1132.  
  1133.       {ioPermission values}
  1134.       fsCurPerm     = 0;
  1135.       fsRdPerm      = 1;
  1136.       fsWrPerm      = 2;
  1137.       fsRdWrPerm    = 3;
  1138.       fsRdWrShPerm  = 4;
  1139.  
  1140. TYPE
  1141.   ParamBlkType = (IOParam, FileParam, VolumeParam, CntrlParam);
  1142.  
  1143.   OSType = PACKED ARRAY [1..4] OF CHAR; {same as rsrc mgr's Restype}
  1144.  
  1145.   FInfo = RECORD                {record of finder info}
  1146.             fdType: OSType;     {the type of the file}
  1147.             fdCreator: OSType;  {file's creator}
  1148.             fdFlags: INTEGER;   {flags ex. hasbundle,invisible,locked,
  1149.                                     etc.}
  1150.             fdLocation: Point;  {file's location in folder}
  1151.             fdFldr: INTEGER;    {folder containing file}
  1152.           END; {FInfo}
  1153.  
  1154.  
  1155.   FXInfo = RECORD
  1156.              fdIconID: INTEGER;         {Icon ID}
  1157.              fdUnused: ARRAY [1..4] OF INTEGER; {unused but reserved 8 bytes}
  1158.              fdComment: INTEGER;        {Comment ID}
  1159.              fdPutAway: LongInt;        {Home Dir ID}
  1160.            END;
  1161.  
  1162.   DInfo = RECORD
  1163.             frRect: Rect;       {folder rect}
  1164.             frFlags: INTEGER;   {Flags}
  1165.             frLocation: Point;  {folder location}
  1166.             frView: INTEGER;    {folder view}
  1167.           END;
  1168.  
  1169.   DXInfo = RECORD
  1170.              frScroll: Point;       {scroll position}
  1171.              frOpenChain: LongInt;  {DirID chain of open folders}
  1172.              frUnused: INTEGER;     {unused but reserved}
  1173.              frComment: INTEGER;    {comment}
  1174.              frPutAway: LongInt;    {DirID}
  1175.            END;
  1176.  
  1177.  
  1178.   ParamBlockRec = RECORD
  1179.   {12 byte header used by the file and IO system}
  1180.     qLink: QElemPtr;        {queue link in header}
  1181.     qType: INTEGER;         {type byte for safety check}
  1182.     ioTrap: INTEGER;        {FS: the Trap}
  1183.     ioCmdAddr: Ptr;         {FS: address to dispatch to}
  1184.  
  1185.              {common header to all variants}
  1186.     ioCompletion: ProcPtr; {completion routine addr (0 for
  1187.                             synch calls)}
  1188.     ioResult: OSErr;        {result code}
  1189.     ioNamePtr: StringPtr;   {ptr to Vol:FileName string}
  1190.     ioVRefNum: INTEGER;     {volume refnum (DrvNum for Eject and
  1191.                                 MountVol)}
  1192.  
  1193. {different components for the different type of parameter blocks}
  1194.     CASE ParamBlkType OF
  1195.       IOParam:
  1196.         (ioRefNum: INTEGER;     {refNum for I/O operation}
  1197.          ioVersNum: SignedByte; {version number}
  1198.          ioPermssn: SignedByte; {Open: permissions (byte)}
  1199.  
  1200.          ioMisc: Ptr;           {Rename: new name}
  1201.                                 {GetEOF,SetEOF: logical end of file}
  1202.                                 {Open: optional ptr to buffer}
  1203.                                 {SetFileType: new type}
  1204.          ioBuffer: Ptr;         {data buffer Ptr}
  1205.          ioReqCount: LongInt;   {requested byte count; also =
  1206.                                  ioNewDirID}
  1207.          ioActCount: LongInt;   {actual byte count completed}
  1208.          ioPosMode: INTEGER;    {initial file positioning}
  1209.          ioPosOffset: LongInt); {file position offset}
  1210.  
  1211.       FileParam:
  1212.         (ioFRefNum: INTEGER;        {reference number}
  1213.          ioFVersNum: SignedByte;    {version number}
  1214.          filler1: SignedByte;
  1215.          ioFDirIndex: INTEGER;      {GetFInfo directory index}
  1216.          ioFlAttrib: SignedByte;    {GetFInfo: in-use bit=7, lock
  1217.                                         bit=0}
  1218.          ioFlVersNum: SignedByte;   {file version number}
  1219.          ioFlFndrInfo: FInfo;       {user info}
  1220.          ioFlNum: LongInt;          {GetFInfo: file number; TF-
  1221.                                         ioDirID}
  1222.          ioFlStBlk: INTEGER;        {start file block (0 if none)}
  1223.          ioFlLgLen: LongInt;        {logical length (EOF)}
  1224.          ioFlPyLen: LongInt;        {physical lenght}
  1225.          ioFlRStBlk: INTEGER;       {start block rsrc fork}
  1226.          ioFlRLgLen: LongInt;       {file logical length rsrc fork}
  1227.          ioFlRPyLen: LongInt;       {file physical length rsrc fork}
  1228.          ioFlCrDat: LongInt;        {file creation date & time (32
  1229.                                         bits in secs)}
  1230.          ioFlMdDat: LongInt);       {last modified date and time}
  1231.  
  1232.       VolumeParam:
  1233.         (filler2: LongInt;
  1234.          ioVolIndex: INTEGER;   {volume index number}
  1235.          ioVCrDate: LongInt;    {creation date and time}
  1236.          ioVLsBkUp: LongInt;    {last backup date and time}
  1237.          ioVAtrb: INTEGER;      {volume attrib}
  1238.          ioVNmFls: INTEGER;     {number of files in directory}
  1239.          ioVDirSt: INTEGER;     {start block of file directory}
  1240.          ioVBlLn: INTEGER;      {GetVolInfo: length of dir in
  1241.                                     blocks}
  1242.          ioVNmAlBlks: INTEGER;  {GetVolInfo: num blks (of alloc
  1243.                                     size)}
  1244.          ioVAlBlkSiz: LongInt;  {GetVolInfo: alloc blk byte
  1245.                                     size}
  1246.          ioVClpSiz: LongInt;    {GetVolInfo: bytes to allocate at
  1247.                                     a time}
  1248.          ioAlBlSt: INTEGER;     {starting disk(512-byte) block in
  1249.                                     block map}
  1250.          ioVNxtFNum: LongInt;   {GetVolInfo: next free file
  1251.                                     number}
  1252.          ioVFrBlk: INTEGER);    {GetVolInfo: # free alloc blks
  1253.                                     for this vol}
  1254.  
  1255.       CntrlParam:
  1256.         (ioCRefNum: INTEGER;        {refNum for I/O operation}
  1257.          CSCode: INTEGER;           {word for control status code}
  1258.          CSParam: ARRAY [0..10] OF INTEGER); {operation-defined
  1259.                                                 parameters}
  1260.   END; {ParamBlockRec}
  1261.  
  1262.   ParmBlkPtr = ^ParamBlockRec;
  1263.  
  1264. \ ,146
  1265. 146
  1266. Printing Manager Definitions.
  1267.  
  1268. CONST
  1269.   iPrPgFract = 120; {Page scale factor. ptPgSize (below) is in units of
  1270.                      1/iPrPgFract }
  1271.  
  1272.   iPrPgFst      = 1; {Page range constants}
  1273.   iPrPgMax      = 9999;
  1274.  
  1275.   iPrRelease    = 3; {Current version number of the code.} {DC 7/23/84}
  1276.   iPfMaxPgs     = 128; {Max number of pages in a print file.}
  1277.  
  1278.   {Driver constants}
  1279.   iPrBitsCtl    = 4; {The Bitmap Print Proc's ctl number}
  1280.   lScreenBits   = $00000000; {The Bitmap Print Proc's Screen Bitmap
  1281.                                 param}
  1282.   lPaintBits    = $00000001; {The Bitmap Print Proc's Paint [sq pix]
  1283.                                 param}
  1284.   lHiScreenBits = $00000010; {The Bitmap Print Proc's Screen Bitmap
  1285.                                 param}
  1286.   lHiPaintBits  = $00000011; {The Bitmap Print Proc's Paint [sq pix]
  1287.                                 param}
  1288.   iPrIOCtl      = 5; {The Raw Byte IO Proc's ctl number}
  1289.   iPrEvtCtl     = 6; {The PrEvent Proc's ctl number}
  1290.   lPrEvtAll     = $0002FFFD; {The PrEvent Proc's CParam for the entire
  1291.                                 screen}
  1292.   lPrEvtTop     = $0001FFFD; {The PrEvent Proc's CParam for the top
  1293.                                 folder}
  1294.   iPrDevCtl     = 7;         {The PrDevCtl Proc's ctl number}
  1295.   lPrReset      = $00010000; {The PrDevCtl Proc's CParam for reset}
  1296.   lPrPageEnd    = $00020000; {The PrDevCtl Proc's CParam for end page}
  1297.   lPrLineFeed   = $00030000; {The PrDevCtl Proc's CParam for paper
  1298.                                 advance}
  1299.   lPrLFSixth    = $0003FFFF; {The PrDevCtl Proc's CParam for 1/6 th inch
  1300.                                 paper advance}
  1301.   lPrLFEighth   = $0003FFFE; {The PrDevCtl Proc's CParam for 1/8 th inch
  1302.                                 paper advance}
  1303.   iFMgrCtl      = 8;         {The FMgr's Tail-hook Proc's ctl number}
  1304.   { [The Pre-Hook is the status call] }
  1305.  
  1306.   {Error Constants:}
  1307.   iMemFullErr   = - 108;
  1308.   iPrAbort      = 128;
  1309.   iIOAbort      = - 27;
  1310.  
  1311.   {The PrVars lo mem area:}
  1312.   pPrGlobals    = $00000944;
  1313.   bDraftLoop    = 0;
  1314.   bSpoolLoop    = 1;
  1315.   bUser1Loop    = 2;
  1316.   bUser2Loop    = 3;
  1317.  
  1318.   {The Currently supported printers:}
  1319.   bDevCItoh     = 1;
  1320.   iDevCItoh     = $0100; {CItoh}
  1321.   bDevDaisy     = 2;
  1322.   iDevDaisy     = $0200; {Daisy}
  1323.   bDevLaser     = 3;
  1324.   iDevLaser     = $0300; {Laser}
  1325.  
  1326. TYPE
  1327.   TPRect = ^Rect;       {A Rect Ptr}
  1328.   TPBitMap = ^BitMap;   {A BitMap Ptr}
  1329.  
  1330.   {NOTE: Changes will also affect: PrEqu, TCiVars & TPfVars}
  1331.   TPrVars = RECORD {4 longs for printing, see SysEqu for location.}
  1332.               iPrErr: Integer; {Current print error. Set to iPrAbort to
  1333.                                     abort printing.}
  1334.               bDocLoop: SignedByte; {The Doc style: Draft, Spool, ..,
  1335.                                     and .. Currently use low 2 bits; the
  1336.                                     upper 6 are for flags.}
  1337.               bUser1: SignedByte; {Spares used by the print code}
  1338.               lUser1: LongInt;
  1339.               lUser2: LongInt;
  1340.               lUser3: LongInt;
  1341.             END;
  1342.   TPPrVars = ^TPrVars;
  1343.  
  1344.   TPrInfo = RECORD {Print Info Record: The parameters needed for page
  1345.                     composition.}
  1346.               iDev: Integer; {Font mgr/QuickDraw device code}
  1347.               iVRes: Integer; {Resolution of device, in device
  1348.                                 coordinates}
  1349.               iHRes: Integer; { ..note: V before H => compatable with
  1350.                                 Point.}
  1351.               rPage: Rect; {The page (printable) rectangle in device
  1352.                             coordinates.}
  1353.             END;
  1354.   TPPrInfo = ^TPrInfo;
  1355.  
  1356.   {These are types of paper feeders.}
  1357.   TFeed = (feedCut, feedFanfold, feedMechCut, feedOther);
  1358.  
  1359.   TPrStl = RECORD {Printer Style: The printer configuration and usage
  1360.                    information.}
  1361.              wDev: Integer; {The device (driver) number. Hi byte=RefNum,
  1362.                                 Lo byte=variant. f0 = fHiRes,
  1363.                                 f1 = fPortrait, f2 = fSqPix,
  1364.                                 f3 = f2xZoom, f4 = fScroll.}
  1365.              iPageV: Integer; {paper size in units of 1/iPrPgFract}
  1366.              iPageH: Integer; { ..note: V before H => compatable with
  1367.                                 Point.}
  1368.              bPort: SignedByte; {The IO port number. Refnum?}
  1369.              feed: TFeed; {paper feeder type.}
  1370.            END;
  1371.   TPPrStl = ^TPrStl;
  1372.  
  1373.   {Banding data structures. Not of general interest to Apps.}
  1374.   TScan = {Band Scan direction Top-Bottom, Left-Right, etc.}
  1375.   (scanTB, scanBT, scanLR, scanRL);
  1376.  
  1377.   TPrXInfo = RECORD {The print time eXtra information.}
  1378.                iRowBytes: Integer; {The Band's rowBytes.}
  1379.                iBandV: Integer; {Size of band, in device coordinates}
  1380.                iBandH: Integer; { ..note: V before H => compatible with
  1381.                                  Point.}
  1382.                iDevBytes: Integer; {Size for allocation. May be more
  1383.                                     than rBounds size!}
  1384.                iBands: Integer; {Number of bands per page.}
  1385.  
  1386.                bPatScale: SignedByte; {Pattern scaling}
  1387.                bULThick: SignedByte; {3 Underscoring parameters}
  1388.                bULOffset: SignedByte;
  1389.                bULShadow: SignedByte;
  1390.  
  1391.                scan: TScan; {Band scan direction}
  1392.                bXInfoX: SignedByte; {An eXtra byte.}
  1393.              END;
  1394.   TPPrXInfo = ^TPrXInfo;
  1395.  
  1396.   TPrJob = RECORD {Print Job: Print "form" for a single print request.}
  1397.              iFstPage: Integer; {Page Range.}
  1398.              iLstPage: Integer;
  1399.              iCopies: Integer; {No. copies.}
  1400.              bJDocLoop: SignedByte; {The Doc style: Draft, Spool, ..,
  1401.                                         and ..}
  1402.              fFromUsr: Boolean; {Printing from an User's App (not PrApp)
  1403.                                     flag}
  1404.              pIdleProc: ProcPtr; {The Proc called while waiting on IO
  1405.                                     etc.}
  1406.              pFileName: StringPtr; {Spool File Name: NIL for default.}
  1407.              iFileVol: Integer; {Spool File vol, set to 0 initially}
  1408.              bFileVers: SignedByte; {Spool File version, set to 0
  1409.                                         initially}
  1410.              bJobX: SignedByte; {An eXtra byte.}
  1411.            END;
  1412.   TPPrJob = ^TPrJob;
  1413.  
  1414.   TPrint = RECORD {The universal 120 byte printing record}
  1415.              iPrVersion: Integer; {2} {Printing software version}
  1416.              PrInfo: TPrInfo; {14} {the PrInfo data associated with the
  1417.                                     current style.}
  1418.              rPaper: Rect; {8} {The paper rectangle [offset from rPage]}
  1419.              PrStl: TPrStl; {8} {This print request's style.}
  1420.              PrInfoPT: TPrInfo; {14} {Print Time Imaging metrics}
  1421.              PrXInfo: TPrXInfo; {16} {Print-time (expanded) Print info
  1422.                                       record.}
  1423.              PrJob: TPrJob; {20} {The Print Job request}
  1424.                   {82} {Total of the above; 120-82 = 38 bytes needed to
  1425.                         fill 120}
  1426.              PrintX: ARRAY [1..19] OF Integer; {Spare to fill to 120
  1427.                                                 bytes!}
  1428.            END;
  1429.   TPPrint = ^TPrint;
  1430.   THPrint = ^TPPrint;
  1431.  
  1432. {Printing Graf Port. All printer imaging, whether spooling, banding, etc, happens "thru" a GrafPort.}
  1433.   TPrPort = RECORD {This is the "PrPeek" record.}
  1434.               GPort: GrafPort; {The Printer's graf port.}
  1435.               GProcs: QDProcs; {..and its procs}
  1436.  
  1437.               lGParam1: LongInt; {16 bytes for private parameter storage.}
  1438.               lGParam2: LongInt;
  1439.               lGParam3: LongInt;
  1440.               lGParam4: LongInt;
  1441.  
  1442.               fOurPtr: Boolean; {Whether the PrPort allocation was done by
  1443.                                  us.}
  1444.               fOurBits: Boolean; {Whether the BitMap allocation was done by
  1445.                                   us.}
  1446.             END;
  1447.   TPPrPort = ^TPrPort;
  1448.  
  1449.   TPrStatus = RECORD {Print Status: Print information during printing.}
  1450.                 iTotPages: Integer; {Total pages in Print File.}
  1451.                 iCurPage: Integer; {Current page number}
  1452.                 iTotCopies: Integer; {Total copies requested}
  1453.                 iCurCopy: Integer; {Current copy number}
  1454.                 iTotBands: Integer; {Total bands per page.}
  1455.                 iCurBand: Integer; {Current band number}
  1456.                 fPgDirty: Boolean; {True if current page has been written to.}
  1457.                 fImaging: Boolean; {Set while in band's DrawPic call.}
  1458.                 hPrint: THPrint; {Handle to the active Printer record}
  1459.                 pPrPort: TPPrPort; {Ptr to the active PrPort}
  1460.                 hPic: PicHandle; {Handle to the active Picture}
  1461.               END;
  1462.   TPPrStatus = ^TPrStatus;
  1463.  
  1464. {PicFile = a TPfHeader followed by n QuickDraw Pics (whose PicSize is invalid!)}
  1465.   TPfPgDir = RECORD
  1466.                iPages: Integer;
  1467.                lPgPos: ARRAY [0..iPfMaxPgs] OF LongInt;
  1468.              END;
  1469.   TPPfPgDir = ^TPfPgDir;
  1470.   THPfPgDir = ^TPPfPgDir;
  1471.  
  1472.   TPfHeader = RECORD {Print File header.}
  1473.                 Print: TPrint;
  1474.                 PfPgDir: TPfPgDir;
  1475.               END;
  1476.   TPPfHeader = ^TPfHeader;
  1477.   THPfHeader = ^TPPfHeader; {Note: Type compatable with an hPrint.}
  1478.  
  1479. { This is the Printing Dialog Record. Only used by folks appending their own dialogs. }
  1480.   TPrDlg = RECORD {Print Dialog: The Dialog Stream object.}
  1481.              Dlg: DialogRecord; {The Dialog window}
  1482.              pFltrProc: ProcPtr; {The Filter Proc.}
  1483.              pItemProc: ProcPtr; {The Item evaluating proc.}
  1484.              hPrintUsr: THPrint; {The user's print record.}
  1485.              fDoIt: Boolean;
  1486.              fDone: Boolean;
  1487.              lUser1: LongInt; {Four longs for user's to hang global data.}
  1488.              lUser2: LongInt;
  1489.              lUser3: LongInt;
  1490.              lUser4: LongInt;
  1491.               {  ...Plus more stuff needed by the particular printing dialog.}
  1492.            END;
  1493.   TPPrDlg = ^TPrDlg; {== a dialog ptr}
  1494. \ ,147
  1495. 147
  1496. Device Manager Definitions.
  1497.  
  1498. \ ,148
  1499. 148
  1500. Disk Driver Definitions.
  1501.  
  1502. \ ,149
  1503. 149
  1504. Sound Driver Definitions.
  1505. \ ,154
  1506. 154
  1507. List Manager Definitions.
  1508.  
  1509. CONST
  1510.  
  1511. { Masks for selection flags (selFlags) }
  1512.  
  1513.     LOnlyOne = -128;        { 0 = multiple selections, 1 = one }
  1514.     LExtendDrag = 64;       { 1 = drag select without shift key }
  1515.     LNoDisjoint = 32;       { 1 = turn off selections on click }
  1516.     LNoExtend = 16;         { 1 = don't extend shift selections }
  1517.     LNoRect = 8;            { 1 = don't grow (shift,drag) selection as
  1518.                                 rect }
  1519.     LUseSense = 4;          { 1 = shift should use sense of start cell }
  1520.     LNoNilHilite = 2;       { 1 = don't hilite empty cells }
  1521.  
  1522. { Masks for other flags (listFlags) }
  1523.  
  1524.     LDoVAutoscroll = 2;     { 1 = allow vertical autoscrolling }
  1525.     LDoHAutoscroll = 1;     { 1 = allow horizontal autoscrolling }
  1526.  
  1527. { Messages to list definition procedure }
  1528.  
  1529.     LInitMsg = 0;           { tell drawing routines to init themselves }
  1530.     LDrawMsg = 1;           { draw (and de/select) the indicated data }
  1531.     LHiliteMsg = 2;         { invert hilite state of specified cell }
  1532.     LCloseMsg = 3;          { shut down, the list is being disposed }
  1533.  
  1534. TYPE
  1535.  
  1536.     Cell = Point;
  1537.  
  1538.     dataArray  = PACKED ARRAY[0..32000] OF Char;
  1539.     dataPtr    = ^dataArray;
  1540.     dataHandle = ^dataPtr;
  1541.  
  1542.     ListPtr    = ^ListRec;
  1543.     ListHandle = ^ListPtr;
  1544.     ListRec    = RECORD
  1545.             rView : Rect;               {Rect in which we are viewed}
  1546.             port : GrafPtr;             {Grafport that owns us}
  1547.             indent : Point;             {Indent pixels in cell}
  1548.             cellSize : Point;           {Cell size}
  1549.             visible : Rect;             {visible row/column bounds}
  1550.             vScroll : ControlHandle;    {vertical scroll bar (or NIL)}
  1551.             hScroll : ControlHandle;    {horizontal scroll bar (or NIL)}
  1552.             selFlags : SignedByte;      { defines selection characteristics
  1553.             LActive : Boolean;          { active or not }
  1554.             LReserved : SignedByte;     { internally used flags }
  1555.             listFlags : SignedByte;     { other flags }
  1556.             clikTime : Longint;         { save time of last click }
  1557.             clikLoc : Point;            { save position of last click }
  1558.             mouseLoc : Point;           { current mouse position }
  1559.             LClikLoop : Ptr;            { routine called repeatedly during
  1560.                                         ListClick }
  1561.             lastClick : Cell;           { the last cell clicked in }
  1562.             refCon : Longint;           { reference value }
  1563.             listDefProc : Handle;       { Handle to the defProc }
  1564.             userHandle : Handle;        { General purpose handle for user}
  1565.             dataBounds : Rect;          { Total number of rows/columns}
  1566.             cells : dataHandle;         { Handle to data}
  1567.             maxIndex : Integer;         { index past the last element}
  1568.             cellArray : ARRAY[1..1] OF Integer;     { offsets to elements }
  1569.         END;
  1570. \ InitResources
  1571. 1
  1572. FUNCTION InitResources : INTEGER;
  1573.  
  1574.     InitResources is called by the system whcn it starts up, and should
  1575. not be called by the application. It initializes the Resource Manager,
  1576. opens the system resource file, reads the resource map from the file
  1577. into memory, and returns a reference number for the file.
  1578.  
  1579. (note)
  1580.     The application doesn't need the reference number for the 
  1581.     system resource file, because every Resource Manager
  1582.     routine that has a reference number as a parameter
  1583.     interprets Ø to mean the system resource file.
  1584.  
  1585.  
  1586. \ RsrcZoneInit
  1587. 1
  1588. PROCEDURE RsrcZoneInit;
  1589.  
  1590.     RsrcZoneInit is called automatically when your application starts
  1591. up, to initialize the resource map read from the system resource file;
  1592. normally you'll have no need to call it directly. It "cleans up" after
  1593. any resource access that may have been done by a previous application.
  1594. First it closes all open resource files except the system resource
  1595. file. Then, for every system resource that was read into the
  1596. application heap (that is, whose resSysHeap attribute is Ø), it
  1597. replaces the handle to that resource in the resource map with NIL.
  1598. This lets the Resource Manager know that the resource will have to be
  1599. read in again (since the previous application heap is no longer
  1600. around).
  1601.  
  1602.  
  1603. \ CreateResFile
  1604. 1
  1605. PROCEDURE CreateResFile (fileName: Str255);
  1606.  
  1607.     CreateResFile creates a resource file containing no resource data or
  1608. copy of the file's directory entry. If there's no file at all with the
  1609. given name, it also creates an empty data fork for the file. If
  1610. there's already a resource file with the given name (that is, a
  1611. resource form that isn't empty), CreateResFile will do nothing and the 
  1612. ResError function will return an appropriate Operating System result
  1613. code.
  1614.  
  1615. (note)
  1616.     Before you can work with the resource file, you need to
  1617.     open it with OpenResFile.
  1618.  
  1619.  
  1620. \ OpenResFile
  1621. 1
  1622. FUNCTION OpenResFile (fileName: Str255) : INTEGER;
  1623.  
  1624.     OpenResFile opens the resource file having the given name and makes
  1625. it the current resource file. It reads the resource map from the file
  1626. into memory and returns a reference number for the file. It also reads
  1627. in every resource whose resPreload attribute is set. If the resource
  1628. file is already open, it doesn't make it the current resource file; it
  1629. simply returns the reference number.
  1630.  
  1631. (note)
  1632.     You don't have to call OpenResFile to open the system
  1633.     Resource file or the application's resource file, because
  1634.     they're opened when the system and the application start
  1635.     up, respectively. To get the reference number of the
  1636.     application's resource file, you can call CurResFile
  1637.     after the application starts up (before you open any
  1638.     other resource file).
  1639.  
  1640.     If the file can't be opened, OpenResÏile will return -1 and the
  1641. ResError function will return an appropriate Operating System result
  1642. code. For example, an error occurs if there's no resource file with 
  1643. the given name.
  1644.  
  1645. \ CloseResFile
  1646. 1
  1647. PROCEDURE CloseResFile (refNum: INTEGER);
  1648.  
  1649.     Given the reference number of a resource file, CloseResFile does the
  1650. following:
  1651.  
  1652.     - updates the resource file by calling the UpdateResFile procedure
  1653.  
  1654.     - for each resource in the resource file, releases the memory it
  1655.       occupies by calling the ReleaseResource procedure
  1656.  
  1657.     - releases the memory occupied by the resource map
  1658.  
  1659.     - closes the resource file
  1660.  
  1661.     If there's no resource file open with the given reference number,
  1662. CloseResFile will do nothing and the ResError function will return the
  1663. result code resFNotFound. A refNum of Ø represents the system resource
  1664. file, but if you ask to close this file, CloseResFile first closes all
  1665. other open resource files.
  1666.  
  1667.     A CloseResFile of every open resource file except the system
  1668. resource file is done automatically when the application terminates. So
  1669. you only need to call CloseResFile if you want to close the system
  1670. resource file, or if you want to close any resource file before the
  1671. application terminates.
  1672.  
  1673.  
  1674. \ ResError
  1675. 1
  1676. FUNCTION ResError : INTEGER;
  1677.  
  1678.     Called after one of the various Resource Manager routines that may
  1679. result in an error condition, ResError returns a result code
  1680. identifying the error, if any. If no error occurred, it returns the
  1681. result code
  1682.  
  1683.     CONST  noErr = Ø; {no error}
  1684.  
  1685.     If an error occurred at the Operating System level, it returns an
  1686. Operating System result code, such as the File Manager "disk I/O" error
  1687. or the Memory Manager "out of memory" error. (See the File Manager and
  1688. Memory Manager manuals for a list of the result codes.)  If an error
  1689. happened at the Resource Manager level, ResError returns one of the
  1690. following result codes:
  1691.  
  1692.     CONST   resNotFound  =  -192;   {resource not found}
  1693.         resFNotFound =  -193;   {resouce file not found}
  1694.         addResFailed =  -194;   {AddResource failed}
  1695.         rmvResFailed =  -196;   {RmveResource failed}
  1696.  
  1697.     Each routine description tells which errors may occur for that
  1698. routine. You can also check for an error after system startup, which
  1699. calls InitResources, and application startup, which opens the
  1700. application's resource file.
  1701.  
  1702.  
  1703. \ CurResFile
  1704. 1
  1705. FUNCTION CurResFile  : INTEGER;
  1706.  
  1707.     CurResFile returns the reference number of the current resource file
  1708. You can call it when the application starts up to get the reference
  1709. number of its resource file.
  1710.  
  1711. (note)
  1712.     If the system resource file is the current resource file,
  1713.     CurResFile returns the actual reference number of the
  1714.     system reference file (found in the global variable
  1715.     SysMap). You needn't worry about this number being used 
  1716.     (instead of Ø in the routines that require a reference
  1717.     number; these routines recognize both Ø and the actual
  1718.     reference number as referring to the system resource
  1719.     file.
  1720.  
  1721. \ HomeResFile
  1722. 1
  1723. FUNCTION HomeResFile  (theResource: Handle)  :  INTEGER
  1724.  
  1725.     Given a handle to a resource, HomeResFile returns the reference
  1726. number of the resource file containing that resource. If the given
  1727. handle isn't a handle to a resource, HomeResFile will return -1 and the 
  1728. ResError function will return the result code resNotFound.
  1729.  
  1730.  
  1731. \ UseResFile
  1732. 1
  1733. PROCEDURE UseResFile  (refNum:  INTEGER);
  1734.  
  1735.     Given the reference number of a resource file, UseResFile sets the
  1736. current resource file to that file. If there's no resource file open
  1737. with the given reference number, UseResFile will do nothing and the
  1738. ResError function will return the result code resFNotFound. A refNum
  1739. of Ø represents the system resource file.
  1740.  
  1741.     Open resource files are arranged as a linked list; the most recently
  1742. opened file is at the end of the list and is the first one to be
  1743. searched. UseResFile lets you start the search with a file opened
  1744. earlier; the file(s) following it on the list ate then left out of the
  1745. search process. This is best understood with an example. Assume there
  1746. are four open resource files (RØ through R3); the search order is R3,
  1747. R2, R1, RØ. If you call UseResFile(R2), the search order becomes R2,
  1748. R1, RØ; R3 is no longer searched. If you then open a fifth resource
  1749. file (R4), it's added to the end of the list and the search order
  1750. becomes R4, R3, R2, R1, RØ.
  1751.  
  1752.     This procedure is useful if you no longer want to override a system
  1753. resource with one by the same name in your application's resource file. 
  1754. You can call UseResFile(Ø) to leave the application resource file out
  1755. of the search, causing only the system resource file to be searched.
  1756.  
  1757. (warning)
  1758.     Early versions of some desk accessories may, upon
  1759.     closing, always set the current resource file to the one
  1760.     opened just prior to the accessory, ignoring any
  1761.     additional resource files that may have been opened while
  1762.     the accessory was in use. To be safe, whenever desk
  1763.     accessories may have been in use, call UseResFile to
  1764.     ensure access to resource files opened after accessories.
  1765.  
  1766.  
  1767. \ CountTypes
  1768. 1
  1769. FUNCTION CountTypes : INTEGER;
  1770.  
  1771.     CountTypes returns the number of resource types in all open resource
  1772. files.
  1773.  
  1774.  
  1775. \ GetIndType
  1776. 1
  1777. PROCEDURE GetIndType (VAR theType: ResType; index: INTEGER);
  1778.  
  1779.     Given an index ranging from 1 to CountTypes (above, GetIndType
  1780. returns a resource type in theType. Called repeatedly over the entire
  1781. range  for the index, it returns all the resource types in all open
  1782. resource files. If the given index isn't in the range from 1 to
  1783. CountTypes,  GetIndType returns four NUL characters (ASCII code Ø).
  1784.  
  1785.  
  1786. \ SetResLoad
  1787. 1
  1788. PROCEDURE SetResLoad (load: BOOLEAN);
  1789.  
  1790.     Normally, the routines that return handles to resources read the
  1791. resource data into memory if it's not already in memory.
  1792. SetResLoad(FALSE) affects all those routines so that they will not read
  1793. the resource data into memory and will return an empty handle.
  1794. Resources whose resPreload attrribute is set will still be read in,
  1795. however, when a resource file is opened. SetResLoad(TRUE) restores the
  1796. normal state.
  1797.  
  1798. (warning)
  1799.     If you call SetResLoad(FALSE), be sure to restore the
  1800.     normal state as soon as possible, because other parts of
  1801.     the Toolbox that call the Resource Manager rely on it.
  1802.  
  1803.  
  1804. \ CountResources
  1805. 1
  1806. FUNCTION CountResources (theType: ResType) : INTEGER;
  1807.  
  1808.     CountResources returns the total number of resources of the given
  1809. type in all open resource files.
  1810.  
  1811.  
  1812. \ GetIndResource
  1813. 1
  1814. FUNCTION GetIndResource (theType: ResType; index: INTEGER) : Handle;
  1815.  
  1816.     Given an index ranging from 1 to CountResources(theType),
  1817. GetIndResource returns a handle to a resource of the given type (see
  1818. CountResources, above). Called repeatedly over the entire range for
  1819. the index, it returns handles to all resources of the given type in all
  1820. open resource files. GetIndResource reads the resource data into
  1821. memory if it's not already in memory, unless you've called
  1822. SetResLoad(FALSE).
  1823.  
  1824. (warning)
  1825.     The handle returned will be an empty handle if you've
  1826.     called SetResLoad(FALSE) (and the data isn't already in 
  1827.     memory). The handle will become empty if the resource
  1828.     data for a purgeable resource is read in but later
  1829.     purged. (You can test for an empty handle with, for
  1830.     example, myHndl^= NIL.)  To read in the data and make
  1831.     the handle no longer be empty, you can call LoadResource.
  1832.  
  1833.     GetIndResource returns handles for all resources in the most
  1834. recently opened resource file first, and then for those in the resource
  1835. files opened before it, in the reverse of the order that they were
  1836. opened. If you want to find out how many resources of a given type are
  1837. in a particular resource file, you can do so as follows:  Call
  1838. GetIndResource repeatedly with the index ranging from 1 to the number
  1839. of resources of that type. Pass each handle returned by GetIndResource
  1840. to HomeResFile and count all occurrences where the reference number
  1841. returned is that of the desired file. Be sure to start the index from
  1842. 1, and to call SetResLoad(FALSE) so the resources won't be read in.
  1843.  
  1844. (note)
  1845.     The UseResFile procedure affects which file the Resource
  1846.     Manager searches first when looking for a particular
  1847.     resource but not when getting indexed resources  with
  1848.     GetIndResource.
  1849.  
  1850.     If the given index isn't in the range from 1 to
  1851. CountResources(theType), GetIndResource returns NIL and the ResError
  1852. function will return the result code resNotFound. GetIndResource also
  1853. returns NIL if the resource is to be read into memory but won't fit; in
  1854. this case, ResError will return an appropriate Operating System result
  1855. code.
  1856.  
  1857.  
  1858. \ GetResource
  1859. 1
  1860. FUNCTION Get Resource (theType: ResType; the ID: INTEGER) : Handle;
  1861.  
  1862.     GetResource returns a handle to the resource having the given type
  1863. and ID number, reading the resource data into memory if it's not already
  1864. in memory and if you haven't called SetResLoad(FALSE) (see the warning 
  1865. aboove for GetIndResource). GetResource looks in the current resource
  1866. file and all resource files opened before it, in the reverse of the
  1867. order that they were opened; the system resource file is searched last.
  1868. If it doesn't find the resource, GetResource returns NIL and the 
  1869. ResError function will return the result code resNotFound. GetResource
  1870. also returns NIL if the resource is to be read into memory but won't 
  1871. fit; in this case, ResError will return an appropriate Operating System
  1872. result code.
  1873.  
  1874.  
  1875. \ GetNamedResource
  1876. 1
  1877. FUNCTION GetNamedResource (theType: ResType; name: Str255) : Handle;
  1878.  
  1879.     GetNamedResource is the same as GetResource (above) except that you
  1880. pass a resource name instead of an ID number.
  1881.  
  1882.  
  1883. \ LoadResource
  1884. 1
  1885. PROCEDURE LoadResource (theResource: Handle);
  1886.  
  1887.     Given a handle to a resource (returned by GetIndResource,
  1888. GetResource, or GetNamedResource), LoadResource reads that resource into
  1889. memory. It does nothing if the resource is already in memory or if the
  1890. given handle isn't a handle to a resource; in the latter case, the
  1891. ResError function will return the result code resNotFound. Call this
  1892. procedure if you want to access the data for a resource through its
  1893. handle and either you've called SetResLoad(FALSE) or if the resource is
  1894. purgeable.
  1895.  
  1896.     If you've changed the resource data for a purgeable resource and the 
  1897. resource is purged before being written to the resource file, the
  1898. changes will be lost; LoadResource will reread the original resource
  1899. from the resource file. See the descriptions of ChangedResource and
  1900. SetResPurge for information about how to ensure that changes made to
  1901. purgeable resources will be written to the research file.
  1902.  
  1903.  
  1904. \ ReleaseResource
  1905. 1
  1906. PROCEDURE ReleaseResource (theResource: Handle);
  1907.  
  1908.     Given a handle to a resource, ReleaseResource releases the memory
  1909. occupied by the resource data, if any, and replaces the handle to that
  1910. resource in the resource map with NIL. (See Figure 7.)  The given
  1911. handle will no longer be recognized as a handle to a resource; if the
  1912. Resource Manager is subsequently called to get the released resource, a
  1913. new handle will be allocated. Use this procedure only after you're
  1914. completely through with a resource.
  1915.  
  1916.  
  1917. \ Detach Resource
  1918. 1
  1919. PROCEDURE DetachResource (theResource: Handle);
  1920.  
  1921.     Given a handle to a resource, DetachResource replaces the handle to
  1922. that resource in the resource map with NIL. (See Figure 7 above.)  The
  1923. given handle will no longer be recognized as a handle to a resource; if
  1924. the Resource Manager is subsequently called to get the detached
  1925. resource, a new handle will be allocated.
  1926.  
  1927.     DetachResource is useful if you want the resource data to be
  1928. accessed only by yourself through the given handle and not by the
  1929. Resource Manager. DetachResource is also useful in the unusual case
  1930. that you don't want a resource to be released when a resource file is
  1931. closed. To copy a resource, you can call DetachResource followed by
  1932. AddResource (with a new resource ID).
  1933.  
  1934.     If the given handle isn't a handle to a resource, DetachResopurce
  1935. will  do nothing and the ResError function will return the result code
  1936. resNotFound.
  1937.  
  1938.  
  1939. \ UniqueID
  1940. 1
  1941. FUNCTION UniqueID (theType: ResType) : INTEGER;
  1942.  
  1943.     UniqueID returns an ID number greater than Ø that isn't currently
  1944. assigned to any resource of the given type in any open resource file.
  1945. Using this number when you add a new resource to a resource file
  1946. ensures that you won't duplicate a resource ID and override an existing 
  1947. resource.
  1948.  
  1949. (warning)
  1950.     It's possible that UniqueID will return an ID in the 
  1951.     range reserved for system resources (Ø to 127). You
  1952.     should check that the ID returned is greater than 127; if
  1953.     it isn't, call UniqueID again.
  1954.  
  1955.  
  1956. \ GetResInfo
  1957. 1
  1958. PROCEDURE GetResInfo (theResource: Handle; VAR the ID: INTEGER; VAR
  1959.         theType: ResType; VAR name: Str255);
  1960.  
  1961.     Given a handle to a resource, GetResInfo returns the ID number,
  1962. type, and name of the resource. If the given handle isn't a handle to a 
  1963. resource, GetResInfo will do nothing and the ResError function will
  1964. return the result code resNotFound.
  1965.  
  1966.  
  1967. \ GetResAttrs
  1968. 1
  1969. FUNCTION GetResAttrs (theResource: Handle) : INTEGER;
  1970.  
  1971.     Given a handle to a resource, GetResAttrs returns the resource
  1972. attributes for the resource. (Resource attributes are described above
  1973. under "Resource References".)  If the given handle isn't a handle to a
  1974. resource, GetResAttrs will do nothing and the ResError function will
  1975. return the result code resNotFound.
  1976.  
  1977.  
  1978. \ SizeResource
  1979. 1
  1980. FUNCTION SizeResource (the Resource: Handle) : LONGINT;
  1981.  
  1982.     Given a handle to a resource, Size Resource returns the size in
  1983. bytes of the resource in the resource file. If the given handle isn't a
  1984. handle  to a resource, SizeResource will return -1 and the ResError
  1985. function will return the result code resNotFound. It's a good idea to
  1986. call SizeResource and ensure that sufficient space is available before
  1987. reading a resource into memory.
  1988.  
  1989.  
  1990. \ SetResInfo
  1991. 1
  1992. PROCEDURE SetResInfo (theResource: Handle; theID: INTEGER;
  1993.                         name: Str255);
  1994.  
  1995.     Given a handle to a resource, SetResInfo changes the ID number and
  1996. name of the resource to the given ID number and name.
  1997.     _______________________________________________________________
  1998.     Assembly-language note:  If you pass NIL for the name parameter,
  1999.     the name will not be changed.
  2000.     _______________________________________________________________
  2001.  
  2002. (warning)
  2003.     It's a dangerous practice to change the ID number and
  2004.     name of a system resource, because other applications may
  2005.     already access the resource and may no longer work
  2006.     properly.
  2007.  
  2008.     The change will be written to the resource file when the file is
  2009. updated if you follow SetResInfo with a call to ChangedResource.
  2010.  
  2011. (warning)
  2012.     Even if you don't call Changed Resource for this resource,
  2013.     the change may be written to the resource file when the
  2014.     file is updated. If you've ever called ChangedResource
  2015.     for any resource in the file, or if you've added or 
  2016.     removed a resource, the Resource Manager will write out
  2017.     the entire resource map when it updates the file, so all
  2018.     changes made to resource information in the map will
  2019.     become permanent. If you want any of the changes to be
  2020.     temprary, you'll have to restore the original 
  2021.     information before the file is updated.
  2022.  
  2023. SetResInfo does nothing in the following cases:
  2024.  
  2025.     - The resProtected attribute for the resource is set.
  2026.  
  2027.     - The given handle isn't a handle to a resource. The ResError
  2028.       function will return the result code resNotFound.
  2029.  
  2030.     - The resource map becomes too large to fit in memory (which can
  2031.       happen if a name is passed) or sufficient space for the modified
  2032.       resource file can't be reserved on the disk. ResError will return 
  2033.       an appropriate Operating System result code.
  2034.  
  2035.  
  2036. \ SetResAttrs
  2037. 1
  2038. PROCEDURE SetResAttrs (theResource: Handle; attrs: INTEGER);
  2039.  
  2040.     Given a handle to a resource, SetResAttrs sets the resource
  2041. attributes for the resource to attrs. (Resource attributes are
  2042. described above under "Resource Refererence".)  The resProtected
  2043. attribute takes effect immediately; the others take effect the next time
  2044. the resource is read in.
  2045.  
  2046. (warning)
  2047.     Do not use SetResAttrs to set the resChanged attribute;
  2048.     you must call Changed Resource instead. Be sure that the
  2049.     attrs parameter passed to SetResAttrs doesn't change the 
  2050.     current setting of this attribute.
  2051.  
  2052.     The attributes set with SetResAttrs will be written to the resource
  2053. file when the file is updated if you follow SetResAttrs with a call to
  2054. ChangedResource. However, even if you don't call ChangedResource for
  2055. this resource, the change may be written to the resource file when the
  2056. file is updated. See the last warning for SetResInfo (above).
  2057.  
  2058.     If the given handle isn't a handle to a resource, SetResAttrs will
  2059. do nothing and the ResError function will return the result code
  2060. resNotFound.
  2061.  
  2062.  
  2063. \ ChangedResource
  2064. 1
  2065. PROCEDURE ChangedResource (theResource: Handle);
  2066.  
  2067.     Call ChangedResource after changing either the information about a
  2068. resource in the resource map (as described above under SetResInfo and
  2069. SetResAttrs) or the resource data for a resource, if you want the
  2070. change to be permanent. Given a handle to a resource, ChangedResource
  2071. sets the resChanged attribute for the resource. This attribute tells
  2072. the Resource Manager to do both of the following:
  2073.  
  2074.     - write the resource data for the resource to the resource file when
  2075.       the file is updated or when WriteResource is called
  2076.  
  2077.     - write the entire resource map to the resource file when the file
  2078.       is updated.
  2079.  
  2080. (warning)
  2081.     If you change information in the resource map with
  2082.     SetResÈnfo or SetResAttrs and then call ChangedResource,
  2083.     remember that not only the resource map but also the
  2084.     resource data will be written out when the resource file
  2085.     is updated.
  2086.  
  2087.     To change the resource data for a purgeable resource and make the
  2088. change permanent, you have to take special precautions to ensure that
  2089. the resource won't be purged while you're changing it. You can make
  2090. the resource temporarily unpurgeable and then write it out with
  2091. WriteResource before making it purgeable again. You have to use the
  2092. Memory Manager procedures  HNoPurge and HPurge to make the resource
  2093. unpurgeable and purgeable; SetResAttrs can't be used because it won't
  2094. take effect immediately. For example:
  2095.  
  2096.     myHndl := GetResource(type,ID;  {or LoadResource(myHndl) if  }
  2097.                     { you've gotten it previously}
  2098.     HNoPurge(myHndl);       {make it unpurgeable}
  2099.       . .  .          {make the changes here}
  2100.     ChangedResource(myHndl);    {mark it changed}
  2101.         WriteResource(myHndl);      {write it out}
  2102.     HPurge(myHndl)          {make it purgeable again}
  2103.  
  2104.     Or, instead of calling WriteResource to write the data out
  2105. immediately, you can call SetResPurge(TRUE) before making any changes to
  2106. purgeable resource data.
  2107.  
  2108. ChangedResource does nothing in the following cases:
  2109.  
  2110.     - The given handle isn't a handle to a resource. The ResError
  2111.       function will return the result code resNotFound.
  2112.  
  2113.     - Sufficient space for the modified resource file can't be reserved
  2114.       on the disk. ResError will return an appropriate Operating System
  2115.       result code.
  2116.  
  2117. (warning)
  2118.     Be aware that ChangedResource (and not WriteResource)
  2119.     checks to see if there's sufficient disk space to write
  2120.     out the modified file; it there isn't enough space, the 
  2121.     resChanged attribute won't be set. This means that when 
  2122.     Write Resource is called,it won't know that the resource
  2123.     file has been changed; it won't write out the modified
  2124.     file and no error will be returned. For this reason,
  2125.     always check to see that ChangedResource returns noErr.
  2126.  
  2127.  
  2128. \ AddResource
  2129. 1
  2130. PROCEDURE AddResource (theData: Handle; theType: ResType; theID:
  2131.         INTEGER; name: Str255);
  2132.  
  2133.     Given a handle to data in memory (not a handle to an existing
  2134. resource), AddResource adds to the current resource file a resource
  2135. reference that points to the data. It sets the resChanged attribute
  2136. for the resource, so the data will be written to the resource file when
  2137. the file is updated or when WriteResource is called. If the given
  2138. handle is empty, zero-length resource data will be written.
  2139. AddResource does nothing in the following cases:
  2140.  
  2141.     - The given handle is NIL or is already a handle to an existing
  2142.       resource. The ResError function will return the result code
  2143.       addResFailed.
  2144.  
  2145.     - The resource map becomes too large to fit in memory or sufficient
  2146.       space for the modified resource file can't be reserved on the 
  2147.       disk. ResError will return an appropriate Operating System result
  2148.       code.
  2149.  
  2150. (warning)
  2151.     AddResource doesn't verify whether the resource ID you've
  2152.     passed is already assigned to another resource of the
  2153.     same type; be sure to call UniqueID before adding a
  2154.     resource.
  2155.  
  2156.  
  2157. \ RmveResource
  2158. 1
  2159. PROCEDURE RmveResource (theResource: Handle);
  2160.  
  2161.     Given a handle to a resource in the current resource file,
  2162. RmveResource removes the resource reference to the resource. The
  2163. resource data will  be removed from the resource file when the file is
  2164. updated.
  2165.  
  2166. (note)
  2167.     RmveResource doesn't release the memory occupied by the 
  2168.     resource data; to do that, call the Memory Manager
  2169.     procedure DisposHandle after calling RmveResource.
  2170.  
  2171.     If the resProtected attribute for the resource is set or if the
  2172. given handle isn't a handle to a resource in the current resource file, 
  2173. Rmve Resource will do nothing and the ResError function will return the
  2174. result code rmvResFailed.
  2175.  
  2176.  
  2177. \ UpdateResFile
  2178. 1
  2179. PROCEDURE UpdateResFile (refNum: INTEGER);
  2180.  
  2181.     Given the reference number of a resource file, UpdateResFile does
  2182. the following:
  2183.  
  2184.     - Changes, adds, or removes resource data in the file as appropriate
  2185.       to match the map. Remember that changed resource data is written
  2186.       out only if you called ChangedResource (and the call was
  2187.       successful); if you did, the resource data will be written out
  2188.       with WriteResource.
  2189.  
  2190.     - Compacts the resource file, closing up any empty space created
  2191.       when a resource was removed or made larger. (If the size of a
  2192.       changed resource is greater than its original size in the resource
  2193.       file, it's written at the end of the file rather than at its
  2194.       original location; the space occupied by the original is then
  2195.       compacted.)  UpdateResFile doesn't close up any empty space
  2196.       created when a resource is made smaller.
  2197.  
  2198.     - Writes out the resource map of the resource file, if you ever
  2199.       called ChangedResource for any resource in the file or if you
  2200.       added or removed a resource. All changes to resource information
  2201.       in the map will become permanent as a result of this, so if you
  2202.       want any such changes to be temporary, you must restore the
  2203.       original information before calling UpdateResFile.
  2204.  
  2205.     If there's no open resource file with the given reference number,
  2206. UpdateResFile will do nothing and the ResError function will return the
  2207. result code resFNotFound. A refNum of Ø represent the system resource
  2208. file.
  2209.  
  2210.     The CloseResFile procedure calls UpdateResFile before it closes the
  2211. resource file, so you only need to call UpdateResFile yourself if you
  2212. want to update the file without closing it.
  2213.  
  2214.  
  2215. \ WriteResource
  2216. 1
  2217. PROCEDURE WriteResource (theResource: Handle);
  2218.  
  2219.     Given a handle to a resource, WriteResource checks the resChanged
  2220. attribute for that resource and, if it's set (which it will be if you 
  2221. called ChangedResource or AddResource successfully), writes its
  2222. resource data to the resource file and clears its resChanged attribute.
  2223.  
  2224. (warning)
  2225.     Be aware that ChangedResource (and not WriteResource)
  2226.     determines if sufficient disk space is available to write
  2227.     out the modified file; if there isn't it will clear the 
  2228.     resChanged attribute and WriteResource will be unaware of
  2229.     the modifications. For this reason, always verify that
  2230.     ChangedResource returns noErr.
  2231.  
  2232.     If the resource is purgeable and has been purged, zero-length
  2233. resource data will be written. WriteResource does nothing if the
  2234. resProtected attribute for the resource is set or if the given handle
  2235. isn't a handle to a resource; in the latter case, the ResError function
  2236. will return the result code resNotFound.
  2237.  
  2238.     Since the resource file is updated when the application terminates
  2239. or when you call UpdateResFile (or CloseResFile, which calls
  2240. UpdateResFile), you only need to call WriteResource if you want to
  2241. write out just one or a few resources immediately.
  2242.  
  2243. (warning)
  2244.     The maximum size for resources to be written to a
  2245.     resource file is 32K bytes.
  2246.  
  2247.  
  2248. \ SetResPurge
  2249. 1
  2250. PROCEDURE SetResPurge (install: BOOLEAN);
  2251.  
  2252.     SetResPurge(TRUE) sets a  "hook" in the Memory Manager such that
  2253. before purging data specified by a handle,the Memory Manager will first
  2254. pass the handle to the Resource Manager. The Resource Manager will
  2255. determine whether the handle is that of a resource in the application
  2256. heap and, if so, will call WriteResource to write the resource data for
  2257. that resource to the resource file if its resChanged attribute is set
  2258. (see ChangedResource and WriteResource above). SetResPurge(FALSE)
  2259. restores the normal state, clearing the hook so that the Memory Manager
  2260. will once again purge without checking with the Resource Manager.
  2261.  
  2262.     SetResPurge(TRUE) is useful in applications that modify purgeable
  2263. resources. You still have to make the resources temporarily
  2264. unpurgeable while making the changes, as shown in the description of
  2265. ChangedResource, but you can set the purge hook instead of writing the
  2266. data out immediately with WriteResource. Notice that you won't know 
  2267. exactly when the resources are being written out; most applications
  2268. will want more control than this. If you wish, you can set your own
  2269. such hook; for details, refer to the section "Memory Manager Data
  2270. Structures" in the Memory Manager manual.
  2271.  
  2272.  
  2273. \ GetResFileAttrs
  2274. 1
  2275. FUNCTION GetResFileAttrs (refNum: INTEGER) : INTEGER;
  2276.  
  2277.     Given the reference number of a resource file, GetResFileAttrs
  2278. returns the resource file attributes for the file. If there's no
  2279. resource file with the given reference number, GetResFileAttrs will do
  2280. nothing and the ResError function will return the result code
  2281. resFNotFound. A refNum of Ø represents the system resource file.
  2282.  
  2283.  
  2284. \ SetResFileAttrs
  2285. 1
  2286. PROCEDURE SetResFileAttrs (refNum: INTEGER; attrs: INTEGER);
  2287.  
  2288.     Given the reference number of a resource file, SetResFileAttrs sets
  2289. the  resource file attributes of the file to attrs. If there's no
  2290. resource file with the given reference number, SetResFileAttrs will do
  2291. nothing and the ResError function will return the result code
  2292. resFNotFound. A refNum of  Ø represents the system resource file, but
  2293. you shouldn't change its resource file attributes.
  2294.  
  2295.  
  2296. \ AddReference
  2297. 1
  2298. PROCEDURE AddReference (theResource: Handle; theID: INTEGER; name:
  2299.       Str255);
  2300.  
  2301.     Given a handle to a system resource, AddReference adds to the
  2302. current resource file a system reference to the resource, giving it the
  2303. ID number and name specified by the parameters. It sets the resChanged
  2304. attribute for the resource, so the reference will be written to the
  2305. resource file when the file is updated. AddReference does nothing in
  2306. the following cases:
  2307.  
  2308.     - The current resource file is the system resource file or already
  2309.       contains a system reference to the specified resource, or the
  2310.       given handle isn't a handle to a system resource. The ResError
  2311.       function will return the result code.
  2312.  
  2313.         CONST addReFailed = -195;  (AddReference failed)
  2314.  
  2315.     - The resource map becomes too large to fit in the memory or
  2316.       sufficient space for the modified resource file can't be
  2317.       reserved on the disk. ResError will return an appropriate
  2318.       Øperating System result code.
  2319.  
  2320.  
  2321. \ RmveReference
  2322. 1
  2323. PROCEDURE RmveReference (theResource: Handle);
  2324.  
  2325.     Given a handle to a system resource, RmveReference removes the
  2326. system reference to the resource from the current resource file. (The
  2327. reference will be removed from the resource file when the file is
  2328. updated.)  RmveReference will do nothing and the ResError function will
  2329. return the result code.
  2330.  
  2331.         CONST rmvRefFailed = -197;  (RmveReference failed)
  2332.  
  2333. if any of the following are true:
  2334.  
  2335.     - The resProtected attribute for the resource is set.
  2336.  
  2337.     - There's no system reference to the resource in the current 
  2338.       resource file.
  2339.  
  2340.     - The given handle isn't a handle to a system resource. 
  2341.  
  2342. \ Count1Types
  2343. 1
  2344. FUNCTION Count1Types : INTEGER;
  2345.  
  2346.     Count1Types is the same as CountTypes except that it returns the
  2347. number of resource types in the current resource file only.
  2348.  
  2349. \ Get1IndType
  2350. 1
  2351. PROCEDURE Get1IndType (VAR theType: ResType; index: INTEGER);
  2352. ___________________________________________________________________
  2353.  
  2354. Assembly-language note:  The macro you invoke to call Get1IndType
  2355. from assembly language is named _Get1IxType.
  2356. ___________________________________________________________________
  2357.     Get1IndType is the same as GetIndType except that it searches the
  2358. current resource file only. Given an index ranging from 1 to
  2359. Count1Types (above), Get1IndType returns a resource type in theType.
  2360.  
  2361.     Called repeatedly over the entire range for the index, it returns
  2362. all the resource types in the current resource file. If the given
  2363. index isn’t in the range from 1 to Count1Types, Get1IndType returns
  2364. four NUL characters (ASCII code 0).
  2365.  
  2366. \ Count1Resources
  2367. 1
  2368. FUNCTION Count1Resources (theType: ResType) : INTEGER;
  2369.  
  2370.     Count1Resources is the same as CountResources except that it returns
  2371. the total number of resources of the given type in the current resource
  2372. file only.
  2373.  
  2374. \ Get1IndResource
  2375. 1
  2376. FUNCTION Get1IndResource (theType: ResType; index: INTEGER) : Handle;
  2377. ___________________________________________________________________
  2378.  
  2379. Assembly-language note:  The macro you invoke to call
  2380. Get1IndResource from assembly language is named _Get1IxResource.
  2381. ___________________________________________________________________
  2382.     Get1IndResource is the same as GetIndResource except that it
  2383. searches the current resource file only. Given an index ranging from 1
  2384. to Count1Resources(theType), Get1IndResource returns a handle to a
  2385. resource of the given type (see Count1Resources, above). Called
  2386. repeatedly over the entire range for the index, it returns handles to
  2387. all resources of the given type in the current resource file.
  2388.  
  2389. \ Get1Resource
  2390. 1
  2391. FUNCTION Get1Resource (theType: ResType; theID: INTEGER) : Handle;
  2392.  
  2393.     Get1Resource is the same as GetResource except that it searches the
  2394. current resource file only.
  2395.  
  2396. \ Get1NamedResource
  2397. 1
  2398. FUNCTION Get1NamedResource (theType: ResType; name: Str255) : Handle;
  2399.  
  2400.     Get1NamedResource is the same as GetNamedResource except that it
  2401. searches the current resource file only.
  2402.  
  2403. \ Unique1ID
  2404. 1
  2405. FUNCTION Unique1ID (theType: ResType) : INTEGER;
  2406.  
  2407.     Unique1ID is the same as UniqueID except that the ID number it
  2408. returns is unique only with respect to resources in the current resource
  2409. file.
  2410.  
  2411. \ MaxSizeRsrc
  2412. 1
  2413. FUNCTION MaxSizeRsrc (theResource: Handle) : LONGINT;
  2414.  
  2415.     MaxSizeRsrc is similar to SizeResource except that it does not cause
  2416. the disk to be read; instead it determines the size (in bytes) of
  2417. the resource from the offsets found in the resource map.
  2418.  
  2419.     Since MaxSizeRsrc does not read from the disk, it returns only the
  2420. maximum size of the resource. In other words, you can count on the
  2421. resource not being larger than the number of bytes reported by
  2422. MaxSizeRsrc; it’s possible, however, that the resource is actually
  2423. smaller than the resource map indicates (because the file has not
  2424. yet been compacted). If called after UpdateResFile, MaxSizeRsrc will
  2425. return the correct size of the resource.
  2426.  
  2427. \ RsrcMapEntry
  2428. 1
  2429. FUNCTION RsrcMapEntry (theResource: Handle) : LONGINT;
  2430.  
  2431.     RsrcMapEntry  provides a way to access the resource references in
  2432. the resource map. Given a handle to a resource, RsrcMapEntry returns
  2433. the offset of the resource’s reference from the beginning of the
  2434. resource map. (For more information on resource references and the
  2435. structure of a resource map, see the section “Format of a Resource File”
  2436. in the Resource Manager chapter.)  If it doesn’t find the resource,
  2437. RsrcMapEntry returns NIL and the ResError function will return the
  2438. result code resNotFound. If you pass it a NIL handle, RsrcMapEntry
  2439. will return garbage but ResError will return the result code noErr.
  2440.  
  2441. Warning:  Since routines are provided for opening, accessing,
  2442.           and changing resources, there’s really no reason to access
  2443.           resources directly. To avoid damaging the resource file, you
  2444.           should be extremely careful if you use RsrcMapEntry.
  2445.  
  2446.  
  2447. \ OpenRFPerm
  2448. 1
  2449. FUNCTION OpenRFPerm (fileName: Str255; vRefNum: INTEGER; permission: Byte) : INTEGER;
  2450.  
  2451.     OpenRFPerm is similar to OpenResFile except that it allows you to
  2452. specify the read/write permission of the resource file the first time
  2453. it is opened; OpenRFPerm also lets you specify in vRefNum the directory
  2454. or volume on which the file is located (see chapter 19 of this volume
  2455. for more details on directories). Permission can have any of the values
  2456. that you would pass to the File Manager; these values are given
  2457. in “Low-Level File Manager Routines” in chapter 19 of this volume.
  2458.  
  2459.     OpenRFPerm, like OpenResFile, will not open the specified file twice
  2460. it simply returns the reference number already assigned to the file.
  2461. In other words, OpenRFPerm cannot be used to open a second access
  2462. path to a resource file nor can it be used to change the permission
  2463. of an already open file. Since OpenRFPerm gives no indication of
  2464. whether the file was already open, there’s no way to tell whether
  2465. the file’s open permission is what you specified or what was
  2466. specified by an earlier call.
  2467.  
  2468. Note:  The shared read/write permission described in chapter 19
  2469. of this volume has no effect with OpenRFPerm since the Resource
  2470. Manager is unable to deal with a portion of a resource file.
  2471.  
  2472. \ InitGraf
  2473. 2
  2474. PROCEDURE InitGraf (globalPtr: QDPtr);
  2475.  
  2476.     Call InitGraf once and only once at the beginning of your program
  2477. to initialize QuickDraw. It initializes the QuickDraw global variables
  2478. listed below.
  2479.  
  2480.     Variable    Type        Initial Setting
  2481.     -----------------------------------------------
  2482.  
  2483.     thePort     GrafPtr     NIL
  2484.     white       Pattern     all-white pattern
  2485.     black       Pattern     all-black pattern
  2486.     gray        Pattern     50% gray pattern
  2487.     ltGray      Pattern     25% gray pattern
  2488.     dkGray      Pattern     75% gray pattern
  2489.     arrow       Cursor      pointing arrow cursor
  2490.     screenBits  BitMap      Macintosh screen, (Ø,Ø,512,342)
  2491.     randSeed    LongInt     1
  2492.  
  2493.     The globalPtr parameter tells QuickDraw where to store its global
  2494. variables, beginning with thePort. From Pascal programs, this
  2495. parameter should always be set to @the Port; assembly-language
  2496. programmers may choose any location, as long as it can accommodate the
  2497. number of bytes specified by GRAFSIZE in GRAFTYPES.TEXT (see "Using 
  2498. QuickDraw from Assembly Language").
  2499.  
  2500. (hand)
  2501.     To initialize the cursor, call InitCursor (described
  2502.     under "Cursor Handling Routines" below).
  2503.  
  2504. \ OpenPort
  2505. 2
  2506. PROCEDURE OpenPort (gp: GrafPtr);
  2507.  
  2508.     OpenPort allocates space for the given grafPort's visRgn and clipRgn 
  2509. initializes the fields of the frafPort as indicated below, and makes
  2510. the grafPort the current port (see SetPort). You must call OpenPort
  2511. before using any graf∏ort; first perform a NEW to create a grafPtr and
  2512. then use  that graf∏tr in the OpenPort call.
  2513.  
  2514.     Field       Type        Initial Setting
  2515.  
  2516.     device      INTEGER     Ø (Macintosh screen)
  2517.     portBits    BitMap      screenBits (see InitGraf)
  2518.     portRect    Rect        screenBits.bounds (Ø,Ø,512,342)
  2519.     visRgn      RgnHandle   handle to the rectangular region
  2520.                             (Ø,Ø,512,342)
  2521.     clipRgn     RgnHandle   handle to the rectangular region
  2522.                             (-3ØØØØ,-3ØØØØ,3ØØØØ,3ØØØØ)
  2523.     bkPat       Pattern     white
  2524.     fillPat     Pattern     black
  2525.     pnLoc       Point       (Ø,Ø)
  2526.     pnSize      Point       (1,1)
  2527.     pnMode      INTEGER     patCopy
  2528.     pnPat       Pattern     black
  2529.     pnVis       INTEGER     Ø (visible)
  2530.     txFont      INTEGER     Ø (system font)
  2531.     txFace      Style       normal
  2532.     txMode      INTEGER     srcOr
  2533.     txSize      INTEGER     Ø (Font Manager decides)
  2534.     spExtra     INTEGER     Ø
  2535.     fgColor     LongInt     blackColor
  2536.     bkColor     LongInt     whiteColor
  2537.     colrBit     INTEGER     Ø
  2538.     patStretch  INTEGER     Ø
  2539.     picSave     QDHandle    NIL
  2540.     rgnSave     QDHandle    NIL
  2541.     polySave    QDHandle    NIL
  2542.     grafProcs   QDProcsPtr  Nil
  2543.  
  2544.  
  2545. \ InitPort
  2546. 2
  2547. PROCEDURE InitPort (gp: GrafPtr);
  2548.  
  2549.     Given a pointer to a grafPort that has been opened with OpenPort,
  2550. InitPort reinitializes the fields of the grafPort and makes it the
  2551. current port (if it's not already).
  2552.  
  2553. (hand)
  2554.     InitPort does everything OpenPort does except allocate
  2555.     space for the visRgn and clipRgn.
  2556.  
  2557.  
  2558. \ ClosePort
  2559. 2
  2560. PROCEDURE ClosePort (gp: GrafPtr)
  2561.  
  2562.     ClosePort deallocates the space occupied by the given GrafPort's
  2563. visRgn and clipRgn. When you are completely through with a grafPort,
  2564. call this procedure and then dispose of the grafPort (with a DISPOSE of
  2565. the grafPtr).
  2566.  
  2567. (eye)
  2568.     If you do not call ClosePort before disposing of the
  2569.     grafPort, the memory used by the visRgn and clipRgn will
  2570.     be unrecoverable.
  2571.  
  2572. (eye)
  2573.     After calling ClosePort, be sure not use any copies of
  2574.     the visRgn or clipRgn handles that you may have made.
  2575.  
  2576.  
  2577. \ SetPort
  2578. 2
  2579. PROCEDURE SetPort (gp: GrafPtr);
  2580.  
  2581.     SetPort sets the grafPort indicated by gp to be the current port.
  2582. The global pointer thePort always points to the current port. All
  2583. QuickDraw drawing routines affect the bitMap thePort^.portBits and use
  2584. the local coordinate system of thePort^. Note that OpenPort and
  2585. InitPort do a SetPort to the given port.
  2586.  
  2587. (eye)
  2588.     Never do a SetPort to a port that has not been opened
  2589.     with OpenPort.
  2590.  
  2591.     Each port possesses its own pen and text characteristics which
  2592. remain unchanged when the port is not selected as the current port.
  2593.  
  2594.  
  2595. \ GetPort
  2596. 2
  2597. PROCEDURE GetPort (VAR gp: GrafPtr);
  2598.  
  2599.     GetPort returns a pointer to the current grafPort. If you have a
  2600. program that draws into more than one grafPort, it's extremely useful 
  2601. to have each procedure save the current grafPort (with GetPort), set
  2602. its own grafPort, do drawing or calculations, and then restore the
  2603. previous grafPort (with SetPort). The pointer to the current grafPort
  2604. is also available through the global pointer thePort, but you may
  2605. prefer to use GetPort for better readability of your program text. For
  2606. example, a procedure could do a GetPort (savePort) before setting its
  2607. own grafPort and a SetPort (savePort) afterwards to restore the
  2608. previous port.
  2609.  
  2610.  
  2611. \ GrafDevice
  2612. 2
  2613. PROCEDURE GrafDevice (device: INTEGER);
  2614.  
  2615.     GrafDevice sets thePort^.device to the given number, which
  2616. identifies the logical output device for this grafPort. The Font
  2617. Manager uses this information. The initial device number is Ø, which
  2618. represents the Macintosh screen.
  2619.  
  2620. \ SetPortBits
  2621. 2
  2622. PROCEDURE SetPortBits (bm: BitMap);
  2623.  
  2624.     SetPortBits sets the Port^.portBits to any previously defined
  2625. bitMap. This allows you to perform all normal drawing and calculations
  2626. on a buffer other than the Macintosh screen -- for example, a 64Ø-by-7
  2627. output buffer for a C. Itoh printer, or a small off-screen image for
  2628. later "stamping" onto the screen.
  2629.  
  2630.     Remember to prepare all fields of the bitMap before you call
  2631. SetPortBits.
  2632.  
  2633.  
  2634. \ PortSize
  2635. 2
  2636. PROCEDURE PortSize (width, height:  INTEGER);
  2637.  
  2638.     PortSize changes the size of the current grafPort's portRect. THIS 
  2639. DOES NOT AFFECT THE SCREEN; it merely changes the size of the "active
  2640. area" of the grafPort. 
  2641.  
  2642. (hand)
  2643.     This procedure is normally called only by the Window
  2644.     Manager.
  2645.  
  2646.     The top left corner of the portRect remains at its same location;
  2647. the width and height of the portRect are set to the given width and
  2648. height. In other words, PortSize moves the bottom right corner of the
  2649. portRect to a position relative to the top left corner.
  2650.  
  2651.     PortSize does not change the clipRgn or the visRgn, nor does it
  2652. affect the local coordinate system of the grafPort: it changes only the
  2653. portRect's width and height. Remember that all drawing occurs only in 
  2654. the intersection of the portBits.bounds  and the portRect, clipped to
  2655. the visRgn and the clipRgn.
  2656.  
  2657.  
  2658. \ MovePortTo
  2659. 2
  2660. PROCEDURE MovePortTo (leftGlobal,topGlobal: INTEGER);
  2661.  
  2662.     MovePortTo changes the position of the current grafPort's portRect.
  2663. THIS DOES NOT AFFECT THE SCREEN; it merely changes the location at
  2664. which subsequent drawing inside the port will appear.
  2665.  
  2666. (hand)
  2667.     This procedure is normally called only by the Window
  2668.     Manager.
  2669.  
  2670.     The leftGlobal and topGlobal parameters set the distance between the
  2671. top left corner of portBits.bounds and the top left corner of the new
  2672. portRect. For example,
  2673.  
  2674.     MovePortTo(256,171);
  2675.  
  2676. will move the top left corner of the portRect to the center of the
  2677. screen (if portBits is the Macintosh screen) regardless of the local
  2678. coordinate system.
  2679.  
  2680. Like PortSize, MovePortTo does not change the clipRgn or the visRgn,
  2681. nor does it affect the local coordinate system of the grafPort.
  2682.  
  2683.  
  2684. \ SetOrigin
  2685. 2
  2686. PROCEDURE SetOrigin (h,v: INTEGER);
  2687.  
  2688.     SetOrigin changes the local coordinate system of the current
  2689. grafPort. THIS DOES NOT AFFECT THE SCREEN; it does, however, affect
  2690. where subsequent drawing and calculation will appear in the grafPort.
  2691. SetOrigin updates the coordinates of the portBits.bounds, the portRect,
  2692. and the visRgn. All subsequent drawing and calculation routines will
  2693. use the new coordinate system.
  2694.  
  2695.     The h and v parameters set the coordinates of the top left corner of
  2696. the portRect. All other coordinates are calculated from this point.
  2697. All relative distances among any elements in the port will remain the
  2698. same; only their absolute local coordinates will change.
  2699.  
  2700. (hand)
  2701.     SetOrigin does not update the coordinates of the clipRgn
  2702.     or the pen; these items stick to the coordinate system
  2703.     (unlike the port's structure, which sticks to the 
  2704.     screen).
  2705.  
  2706.     SetOrigin is useful for adjusting the coordinate system after a
  2707. scrolling operation. (See ScrollRect under "Bit Transfer Operations"
  2708. below.)
  2709.  
  2710.  
  2711. \ SetClip
  2712. 2
  2713. PROCEDURE SetClip (rgn: RgnHandle);
  2714.  
  2715.     SetClip changes the clipping region of the current grafPort to a
  2716. region equivalent to the given region. Note that this does not change
  2717. the region handle, but affects the clipping region itself. Since SetClip
  2718. makes a copy of the given region, any subsequent changes you make to
  2719. makes a copy of the given region, any subsequent changes you make to
  2720. that region will not affect the clipping region of the port.
  2721.  
  2722.     You can set the clipping region to any arbitrary region, to aid you
  2723. in drawing inside the grafPort. The initial clipRgn is an arbitrarily
  2724. large rectangle.
  2725.  
  2726.  
  2727. \ GetClip
  2728. 2
  2729. PROCEDURE GetClip (rgn: RgnHandle);
  2730.  
  2731.     GetClip changes the given region to a region equivalent to the
  2732. clipping region of the current grafPort. This is the reverse of what
  2733. SetClip does. Like SetClip, it does not change the region handle.
  2734.  
  2735.  
  2736. \ ClipRect
  2737. 2
  2738. PROCEDURE ClipRect (r: Rect);
  2739.  
  2740.     ClipRect changes the clipping region of the current grafPort to a
  2741. rectanble equivalent to given rectangle. Note that this does not
  2742. change the region handle, but affects the region itself.
  2743.  
  2744.  
  2745. \ BackPat
  2746. 2
  2747. PROCEDURE BackPat (pat: Pattern);
  2748.  
  2749.     BackPat sets the background pattern of the current grafPort to the
  2750. given pattern. The background pattern is used in ScrollRect and in all
  2751. QuickDraw routines that perform an "erase" operation.
  2752.  
  2753.  
  2754.  
  2755.  
  2756. \ InitCursor
  2757. 2
  2758. PROCEDURE InitCursor;
  2759.  
  2760.     InitCursor sets the current cursor to the predefined arrow cursor,
  2761. an arrow pointing north-northwest, and sets the CURSOR LEVEL to Ø,
  2762. making the cursor visible. The cursor level, which is initialized to Ø
  2763. when the system is booted, keeps track of the number of times the cursor
  2764. has been hidden to compensate for nested calls to HideCursor and
  2765. ShowCursor (below).
  2766.  
  2767.     Before you call InitCursor, the cursor is undefined (or, if set by a
  2768. previous process, it's whatever that process set it to).
  2769.  
  2770.  
  2771. \ SetCursor
  2772. 2
  2773. PROCEDURE SetCursor (crsr: Cursor);
  2774.  
  2775.     SetCursor sets the current cursor to the 16-by-16-bit image in crsr.
  2776. If the cursor is hidden, it remains hidden and will attain the new
  2777. appearnce when it's uncovered; if the cursor is already visible, it
  2778. changes to the new appearance immediately.
  2779.  
  2780.     The cursor image is initialized by InitCursor to a north-northwest
  2781. arrow, visible on the screen. There is no way to retrieve the current
  2782. cursor image.
  2783.  
  2784. \ HideCursor
  2785. 2
  2786. PROCEDURE HideCursor;
  2787.  
  2788.     HideCursor removes the cursor from the screen, restoring the bits
  2789. under it, and decrements the cursor level (which InitCursor initialized
  2790. to Ø). Every call to HideCursor should be balanced by a subsequent call
  2791. to ShowCursor.
  2792.  
  2793.  
  2794. \ ShowCursor
  2795. 2
  2796. PROCEDURE ShowCursor;
  2797.  
  2798.     ShowCursor increments the cursor level, which may have been
  2799. decremented by HideCursor, and displays the cursor on the screen if the
  2800. level becomes Ø. A call to ShowCursor should balance each previous call
  2801. to HideCursor. The level is not incremented beyond Ø, so extra calls to
  2802. ShowCursor don't hurt.
  2803.  
  2804.     QuickDraw low-level interrupt-driven routines link the cursor with
  2805. the mouse position, so that if the cursor level is Ø (visible), the
  2806. cursor automatically follows the mouse. You don't need to do anything
  2807. but a ShowCursor to have a cursor track the mouse. There is  no way to
  2808. "disconnect" the cursor from the mouse; you can't force the cursor to a 
  2809. certain position, nor can you easily prevent the cursor from entering a
  2810. certain area of the screen.
  2811.  
  2812.     If the cursor has been changed (with SetCursor) while hidden,
  2813. ShowCursor presents the new cursor.
  2814.  
  2815.     The cursor is initialized by InitCursor to a north-northwest arrow,
  2816. not hidden.
  2817.  
  2818.  
  2819. \ ObscureCursor
  2820. 2
  2821. PROCEDURE ObscureCursor;
  2822.  
  2823.     ObscureCursor hides the cursor until the next time the mouse is
  2824. moved. Unlike HideCursor, it has no effect on the cursor level and must
  2825. not be balanced by a call to ShowCursor.
  2826.  
  2827. \ HidePen
  2828. 2
  2829. PROCEDURE HidePen
  2830.  
  2831.     HidePen decrements the current grafPort's pnVis field, which is 
  2832. initialized to Ø by OpenPort; whenever pnVis is negative, the pen does
  2833. not draw on the screen. PnVis keeps track of the number of times the
  2834. pen has been hidden to compensate for nested calls to HidePen and
  2835. ShowPen (below). HidePen is called by OpenRgn, OpenPicture, and
  2836. OpenPoly so that you can define regions, pictures, and polygons without
  2837. drawing on the screen.
  2838.  
  2839. \ ShowPen
  2840. 2
  2841. PROCEDURE ShowPen;
  2842.  
  2843.     ShowPen increment the current grafPort's pnVis field, which may have
  2844. been decremented by HidePen; if pnVis becomes Ø, QuickDraw resumes
  2845. drawing on the screen. Extra calls to ShowPen will increment pnVis
  2846. beyond Ø, so every call to ShowPen should be balanced by a subsequent
  2847. call to HidePen. ShowPen is called by CloseRgn, ClosePicture, and
  2848. ClosePoly.
  2849. \ GetPen
  2850. 2
  2851. PROCEDURE GetPen (VAR pt: Point);
  2852.  
  2853.     GetPen returns the current pen location, in the local coordinates of
  2854. the current grafPort.
  2855. \ GetPenState
  2856. 2
  2857. PROCEDURE GetPenState (VAR pnState: PenState);
  2858.  
  2859.     GetPenState saves the pen location, size, pattern, and mode into a
  2860. storage variable, to be restored later with SetPenState (below). This
  2861. is useful when calling short subroutines that operate in the current
  2862. port but must change the graphics pen: each such procedure can save
  2863. the pen's state when it's called, do whatever it needs to do, and
  2864. restore the previous pen state immediately before returning.
  2865.  
  2866.     The PenState data type is not useful for anything except saving the
  2867. pen's state.
  2868. \ SetPenState
  2869. 2
  2870. PROCEDURE SetPenState (pnState: PenState);
  2871.  
  2872.     SetPenState sets the pen location, size, pattern, and mode in the
  2873. current grafPort to the values stored in pnState. This is usually
  2874. called at the end of a procedure that has altered the pen parameters
  2875. and wants to restore them to their state at the beginning of the
  2876. procedure. (See GetPenState, above.)
  2877. \ PenSize
  2878. 2
  2879. PROCEDURE PenSize (width, height: INTEGER);
  2880.  
  2881.     PenSize sets the dimensions of the graphics pen in the current
  2882. grafPort. All subsequent calls to Line, LineTo, and the procedures
  2883. that draw framed shapes in the current grafPort will use the new pen
  2884. dimensions.
  2885.  
  2886.     The pen dimensions can be accessed in the variable thePort^.pnSize,
  2887. which is of type Point. If either of the pen dimensions is set to a
  2888. negative value, the pen assumes the dimensions (Ø,Ø) and no drawing is
  2889. performed. For a discussion of how the pen draws, see the "General 
  2890. Discussion of Drawing" earlier in this manuel.
  2891. \ PenMode
  2892. 2
  2893. PROCEDURE PenMode (mode: INTEGER);
  2894.  
  2895.     PenMode sets the transfer mode through which the pnPat is
  2896. transferred onto the bitMap when lines or shapes are drawn. The mode
  2897. may be any one of the pattern transfer modes:
  2898.  
  2899.     patCopy     patXor      notPatCopy  notPatXor
  2900.     patOr       patBic      notPatOr    notPatBic
  2901.  
  2902.     If the mode is one of the source transfer modes (or negative), no
  2903. drawing is performed. The current pen mode can be obtained in the
  2904. variable thePort^.pnMode. The initial pen mode is patCopy, in which
  2905. the pen pattern is copied directly to the bitMap.
  2906. \ PenPat
  2907. 2
  2908. PROCEDURE PenPat (pat: Pattern);
  2909.  
  2910.     PenPat sets the pattern that is used by the pen in the current
  2911. grafPort. The standard patterns white, black, gray, ltGray and dkGray
  2912. are predefined; the initial pnPat is black. The current pen pattern
  2913. can be obtained in the variable thePort^.onPat, and this value can be
  2914. assigned (but not compared!) to any other variable of type Pattern.
  2915. \ PenNormal
  2916. 2
  2917. PROCEDURE PenNormal;
  2918.  
  2919.     PenNormal resets the initial state of the pen in the current
  2920. grafPort, as follows:
  2921.  
  2922.     Field       Setting
  2923.     -----           -------
  2924.     pnSize      (1,1)
  2925.     pnMode      patCopy
  2926.     pnPat       black
  2927.  
  2928.     The pen location is not changed.
  2929. \ MoveTo
  2930. 2
  2931. PROCEDURE MoveTo (h,v: INTEGER);
  2932.  
  2933.     MoveTo moves the pen to location  (h,v) in the local coordinates of
  2934. the current grafPort. No drawing is performed.
  2935. \ Move
  2936. 2
  2937. PROCEDURE Move (dh,dv: INTEGER);
  2938.  
  2939.     This procedure moves the pen a distance of dh horizontally and dv
  2940. vertically from its current location; it calls MoveTo(h+dh,v+dv), where
  2941. (h,v) is the current location,  The positive directions are to the
  2942. right and down. No drawing is performed.
  2943. \ LineTo
  2944. 2
  2945. PROCEDURE LineTo (h,v: INTEGER);
  2946.  
  2947.     LineTo draws a line from the current pen location to the location
  2948. specified (in local coordinates) by h and v. The new pen location is
  2949. (h,v) after the line is drawn. See the general discussion of drawing.
  2950.  
  2951.     If a region or polygon is open and being formed, its outline is
  2952. infinitely thin and is not affected by the pnSize, pnMode, or pnPat.
  2953. (See OpenRgn and OpenPoly.)
  2954. \ Line
  2955. 2
  2956. PROCEDURE Line (dh,dv: INTEGER);
  2957.  
  2958.     This procedure draws a line to the location that is a distance of dh
  2959. horizontally and dv vertically from the current pen location; it calls
  2960. LineTo(h+dh,v+dv), where (h,v) is the current location. The positive
  2961. directions are to the right and down. The pen location becomes the
  2962. coordinates of the end of the line after the line is drawn. See the
  2963. general discussion of drawing.
  2964.  
  2965.     If a region or polygon is open and being formed, its outline is
  2966. infinitely thin and is not affected by the pnSize, pnMode, or pnPat.
  2967. (See OpenRgn and OpenPoly.)
  2968. \ TextFont
  2969. 2
  2970. PROCEDURE TextFont (font:INTEGER);
  2971.  
  2972.     TextFont sets the current grafPort's font (thePort^.txFont) to the 
  2973. given font number. The initial font number is Ø, which represents the
  2974. system font.
  2975. \ TextFace
  2976. 2
  2977. PROCEDURE TextFace (face:Style);
  2978.  
  2979.     TextFace sets the current grafPort's character style
  2980. (thePort^.txFace). The Style data type allows you to specify a set of
  2981. one or more of the following predefined constants: bold, italic,
  2982. underline, outline, shadow, condense, and extend. For example:
  2983.  
  2984.     TextFace([bold])                    {bold}
  2985.     TextFace([bold,italic]);            {bold and italic}
  2986.     TextFact(thePort^.txFace+[bold]);   {whatever it was plus bold}
  2987.     TextFace(thePort^.txFace-[bold]);   {whatever it was but not bold}
  2988.     TextFace([]);                       {normal}
  2989. \ TextMode
  2990. 2
  2991. PROCEDURE TextMode (mode: INTEGER);
  2992.  
  2993.     TextMode sets the current grafPort's transfer mode for drawing text
  2994. (thePort^.txMode). The mode should be srcOr, srcXor, or srcBic. The
  2995. initial transfer mode for drawing text is srcOR.
  2996. \ TextSize
  2997. 2
  2998. PROCEDURE TextSize (size: INTEGER);
  2999.  
  3000.     TextSize sets the current grafPort's type size (thePort^.txSize) to
  3001. the given number of points. Any size may be specified, but the result
  3002. will look best if the Font Manager has the font in that size (otherwise
  3003. it will scale a size it does have). The next best result will occur if
  3004. the given state is an even multiple of a size available for the font.
  3005. If Ø is specified, the Font Manager will choose one of the available
  3006. sizes -- whichever is closest to the system font size. The initial
  3007. txSize setting is Ø.
  3008. \ SpaceExtra
  3009. 2
  3010. PROCEDURE SpaceExtra (extra: INTEGER);
  3011.  
  3012.     SpaceExtra sets the current grafPort's spExtra field, which
  3013. specifies the number of pixels by which to widen each space in a line of
  3014. text. This is useful when text is being fully justified (that is,
  3015. aligned with both a left and a right margin). Consider, for example, a
  3016. line that contains three spaces; if there would normally be six pixels
  3017. between the end of the line and the right margin, you would call
  3018. SpaceExtra(2) to print the line with full justification. The initial
  3019. spExtra setting is Ø.
  3020.  
  3021. (hand)
  3022.     Space Extra will also take a negative argument, but be
  3023.     careful not to narrow spaces so much that the text is
  3024.     unreadabe.
  3025.  
  3026.  
  3027. \ DrawChar
  3028. 2
  3029. PROCEDURE DrawChar (ch: CHAR);
  3030.  
  3031.     DrawChar places the given character to the right of the pen
  3032. location, with the left end of its base line at the pen's location, and
  3033. advances the pen accordingly. If the character is not in the font, the
  3034. font's  missing symbol is drawn.
  3035. \ DrawString
  3036. 2
  3037. PROCEDURE DrawString (s: Str255);
  3038.  
  3039.     DrawString performs consecutive calls to DrawChar for each character
  3040. in the supplied string; the string is placed beginning at the current
  3041. pen location and extending right. No formatting (carriage returns, line
  3042. feeds, etc.)  is performed by QuickDraw. The pen location ends up to
  3043. the right of the last character in the string.
  3044. \ DrawText
  3045. 2
  3046. PROCEDURE DrawText (textBuf: QDPtr; firstByte,byteCount: INTEGER);
  3047.  
  3048.     DrawText draws text from an arbitrary structure in memory specified
  3049. by textBuf, starting first Byte bytes into the structure and continuing
  3050. for byteCount bytes. The string of text is placed beginning at the
  3051. current pen location and extending right. No formatting (carriage
  3052. returns, line feeds, etc.) is performed by QuickDraw. The pen location
  3053. ends up to the right of the last character in the string.
  3054. \ CharWidth
  3055. 2
  3056. FUNCTION CharWidth (ch: CHAR) : INTEGER;
  3057.  
  3058.     CharWidth returns the value that will be added to the pen horizontal
  3059. coordinate if the specified character is drawn. CharWidth includes the
  3060. effects of the stylistic variations set with TextFace; if you change
  3061. these after determining the character width but before actually drawing
  3062. the character, the  predetermined width may not be correct. If the
  3063. character is a space, CharWidth also includes the effect of SpaceExtra.
  3064. \ StringWidth
  3065. 2
  3066. FUNCTION StringWidth (s: Str255 ) : INTEGER;
  3067.  
  3068.     StringWidth returns the width of the given text string, which it
  3069. calculates by adding the CharWidths of all the characters in the string
  3070. (see above). This value will be added to the pen horizontal coordinate
  3071. if the specified string is drawn.
  3072. \ TextWidth
  3073. 2
  3074. FUNCTION TextWidth (textBuf: QDPtr; firstByte,byteCount: INTEGER) :
  3075.     INTEGER;
  3076.  
  3077.     TextWidth returns the width of the text stored in the arbitrary
  3078. structure in memory specified by textBuf, starting firstByte bytes into
  3079. the structure and continuing for byteCount bytes. It calculates the
  3080. width by adding the CharWidths of all the characters in the text. (See
  3081. CharWidth, above.)
  3082. \ GetFontInfo
  3083. 2
  3084. PROCEDURE GetFontInfo (VAR into: FontInfo);
  3085.  
  3086.     GetFontInfo returns the following information about the current
  3087. grafPort's character font, taking into consideration the style and size 
  3088. in which the characters will be drawn:  the ascent, descent, maximum
  3089. character width (the greatest distance the pen will move when a
  3090. character is drawn), and leading (the vertical distance between the
  3091. descent line and the ascent line below it), all in pixels. The
  3092. FontInfo data structure is defined as:
  3093.  
  3094.     TYPE FontInfo = RECORD
  3095.             ascent:  INTEGER;
  3096.             descent: INTEGER;
  3097.             widMax:  INTEGER;
  3098.             leading: INTEGER;
  3099.           END;
  3100. \ Forecolor
  3101. 2
  3102. PROCEDURE ForeColor (color: LongInt);
  3103.  
  3104.     ForeColor sets the foreground color for all drawing in the current
  3105. grafPort (^thePort.fgColor) to the given color. The following standard
  3106. colors are predefined:  blackColor, whiteColor, redColor, greenColor,
  3107. blueColor, cyanColor, magentaColor, and yellowColor. The initial
  3108. foreground color is blackColor.
  3109. \ BackColor
  3110. 2
  3111. PROCEDURE BackColor (color: LongInt)
  3112.  
  3113.     BackColor sets the background color for all drawing in the current
  3114. grafPort (^thePort.bkColor) to the given color.  Eight standard colors
  3115. are predefined (see ForeColor above). The initial background color is
  3116. whiteColor.
  3117. \ ColorBit
  3118. 2
  3119. PROCEDURE ColorBit (whichBit: INTEGER);
  3120.  
  3121.     ColorBit is called by printing software for a color printer, or
  3122. other color-imaging software, to set the current grafPort's colrBit
  3123. field to whichBit; this tells QuickDraw which plane of the color picture
  3124. to draw into. QuickDraw will draw into the plane corresponding to bit
  3125. number whichBit. Since QuickDraw can support output devices that have
  3126. up to 32 bits of color information per pixel, the possible range of
  3127. values for whichBit is Ø through 31. The initial value of the colrBit
  3128. field is Ø.
  3129. \ SetRect
  3130. 2
  3131. PROCEDURE SetRect (VAR r: Rect; left,top,right, bottom; INTEGER);
  3132.  
  3133.     SetRect assigns the four boundary coordinates to the rectangle. The
  3134. result is a rectangle with coordinates (left,top,right,bottom).
  3135.  
  3136.     This procedure is supplied as a utility to help you shorten your
  3137. program text. If you want a more readable text at the expense of
  3138. length, you can assign integers (or points) directly into the
  3139. rectangle's fields. There is no significant code size or execution 
  3140. speed advantage to either method; one's just easier to write, and the 
  3141. other's easier to read.
  3142. \ OffSetRect
  3143. 2
  3144. PROCEDURE OffsetRect (VAR r: Rect; dh,dv: INTEGER);
  3145.  
  3146.     OffsetRect moves the rectangle by adding dh to each horizontal
  3147. coordinate and dv to each vertical coordinate. If dh and dv are
  3148. positive, the movement is to the right and down; if either is negative,
  3149. the corresponding movement is in the opposite direction. The rectangle
  3150. retains its shape and size; it's merely moved on the coordinate plane. 
  3151. This does not affect the screen unless you subsequently call a routine
  3152. to draw within the rectangle.
  3153. \ InsetRect
  3154. 2
  3155. PROCEDURE InsetRect (VAR r: Rect; dh,dv: INTEGER);
  3156.  
  3157.     InsetRect shrinks or expands the rectangle. The left and right
  3158. sides are moved in by the amount specified by dh; the top and bottom are
  3159. moved towards the center by the amount specified by dv. If dh or dv is
  3160. negative, the appropriate pair of sides is moved outwards instead of
  3161. inwards.  The effect is to alter the size by 2*dh horizontally and 2*dv
  3162. vertically, with the rectangle remaining centered in the same place on
  3163. the coordinate plane.
  3164.  
  3165.     If the resulting width or height becomes less than 1, the rectangle
  3166. is set to the empty rectangle (Ø,Ø,Ø,Ø).
  3167. \ SectRect
  3168. 2
  3169. FUNCTION SectRect(srcRectA,srcRectB: Rect; VAR dstRect: Rect) :
  3170.     BOOLEAN;
  3171.  
  3172.     SectRect calculates the rectangle that is the intersection of the
  3173. two input rectangles, and returns TRUE if they indeed intersect or FALSE
  3174. if they do not. Rectangles that "touch" at a line or a point are not
  3175. considered intersecting, because their intersection rectangle (really,
  3176. in this case, an intersection line or point) does not enclose any bits
  3177. on the bitMap.
  3178.  
  3179.     If the rectangles do not intersect, the destination rectangle is set
  3180. to (Ø,Ø,Ø,Ø,). SectRect works correctly even if one of the source
  3181. rectangles is also the destination.
  3182. \ UnionRect
  3183. 2
  3184. PROCEDURE UnionRect (srcRectA,srcRectB: Rect; VAR dstRect: Rect);
  3185.  
  3186.     Union Rect calculates the smallest rectangle which encloses both
  3187. input rectangles. It works correctly even if one of the source
  3188. rectangles is also the destination.
  3189. \ PtInRect
  3190. 2
  3191. FUNCTION PtInRect (pt: Point; r: Rect) : BOOLEAN;
  3192.  
  3193.     PtInRect determines whether the pixel below and to the right of the
  3194. given coordinate point is enclosed in the specified rectangle, and
  3195. returns TRUE if so or FALSE if not.
  3196. \ Pt2Rect
  3197. 2
  3198. PROCEDURE Pt2Rect (ptA,ptB: Point; VAR: dstRect: Rect);
  3199.  
  3200.     Pt2Rect returns the smallest rectangle which encloses the two input
  3201. points.
  3202. \ PtToAngle
  3203. 2
  3204. PROCEDURE PtToAngle (r: Rect; pt: Point; VAR angle: INTEGER);
  3205.  
  3206.     PtToAngle calculates an integer angle between a line from the center
  3207. of the rectangle to the given point and a line from the center of the
  3208. rectangle pointing straight up (12 o'clock high). The angle is in 
  3209. degrees from Ø to 359, measured clockwise from 12 o'clock, with 9Ø
  3210. degrees at 3 o'clock, 18Ø at 6o'clock, and 27Ø at 9 o'clock. Other
  3211. angles are measured relative to the rectangle: if the line to the
  3212. given point goes through the top right corner of the rectangle, the
  3213. angle returned is 45 degrees, even if the rectangle is not square; if
  3214. it goes through the bottom right corner, the angle is 135 degrees, and
  3215. so on (see Figure 18).
  3216.  
  3217.     The angle returned might be used as input to one of the procedures
  3218. that manipulate arcs and wedges, as described below under "Graphic 
  3219. Operations on Arcs and Wedges".
  3220. \ EqualRect
  3221. 2
  3222. FUNCTION EqualRect (rectA,rectB: Rect) : BOOLEAN;
  3223.  
  3224.     EqualRect compares the two rectangles and returns TRUE if they are
  3225. equal or FALSE if not. The two rectangles must have identical boundary
  3226. coordinates to be considered equal.
  3227.  
  3228.  
  3229. \ EmptyRect
  3230. 2
  3231. FUNCTION EmptyRect (r: Rect) : BOOLEAN;
  3232.  
  3233.     EmptyRect returns TRUE if the given rectangle is an empty rectangle
  3234. or FALSE if not. A rectangle is considered empty if the bottom
  3235. coordinate is equal to or less than the top or the right coordinate is
  3236. equal to or less than the left.
  3237. \ FrameRect
  3238. 2
  3239. PROCEDURE FrameRect (r: Rect);
  3240.  
  3241.     FrameRect draws a hollow outline just inside the specified rectangle
  3242. using the current grafPort's pen pattern, mode, and size. The outline 
  3243. is as wide as the pen width and as tall as the pen height. It is drawn
  3244. with the pnPat, according to the pattern transfer mode specified by
  3245. pnMode. The pen location is not changed by this procedure.
  3246.  
  3247.     If a region is open and being formed, the outside outline of the new
  3248. rectangle is mathematically added to the region's boundary.
  3249. \ PaintRect
  3250. 2
  3251. PROCEDURE PaintRect (r: Rect);
  3252.  
  3253.     PaintRect paints the specified rectangle with the current grafPort's 
  3254. pen pattern and mode. The rectangle on the bitMap is filled with the
  3255. pnPat, according to the pattern transfer mode specified by pnMode. The
  3256. pen location is not changed by this procedure.
  3257. \ EraseRect
  3258. 2
  3259. PROCEDURE EraseRect (r: Rect);
  3260.  
  3261.     EraseRect paints the specified rectangle with the current grafPort's 
  3262. background pattern bkPat (in patCopy mode). The grafPort's pnPat and 
  3263. pnMode are ignored; the pen location is not changed.
  3264. \ InvertRect
  3265. 2
  3266. PROCEDURE InvertRect (r: Rect);
  3267.  
  3268.                 __________________________________________________________________
  3269.                      Assembly-Language note: The macro you invoke to call InvertRect
  3270.                         from  assembly language is named _InverRect.
  3271.                 __________________________________________________________________
  3272.  
  3273.     InvertRect inverts the pixels enclosed by the specified rectangle:
  3274. every white pixel becomes black and every black pixel becomes white.
  3275. The grafPort's pnPat, pnMode, and bkPat are all ignored; the pen 
  3276. location is not changed.
  3277. \ FillRect
  3278. 2
  3279. PROCEDURE FillRect (r: Rect; pat: Pattern);
  3280.  
  3281.     FillRect fills the specified rectangle with the given pattern (in
  3282. patCopy mode). The grafPort's pnPat, pnMode, and bkPat are all 
  3283. ignored; the pen location is not changed.
  3284. \ FrameOval
  3285. 2
  3286. PROCEDURE FrameOval (r: Rect);
  3287.  
  3288.     FrameOval draws a hollow outline just inside the oval that fits
  3289. inside the specified rectangle, using the current grafPort's pen
  3290. pattern, mode, and size. The outline is as wide as the pen width and as
  3291. tall as the pen height. It is drawn with the pnPat, according to the
  3292. pattern transfer mode specified by pnMode. The pen location is not
  3293. changed by this procedure.
  3294.  
  3295.     If a region is open and being formed, the outside outline of the new
  3296. oval is mathematically added to the region's boundary.
  3297. \ PaintOval
  3298. 2
  3299. PROCEDURE PaintOval (r: Rect);
  3300.  
  3301.     PaintOval paints an oval just inside the specified rectangle with
  3302. the current grafPort's pen pattern and mode. The oval on the bitMap is 
  3303. filled with the pnPat, according to the pattern transfer mode specified
  3304. by pnMode. The pen location is not changed by this procedure.
  3305. \ EraseOval
  3306. 2
  3307. PROCEDURE EraseOval (r: Rect);
  3308.  
  3309.     EraseOval paints an oval just inside the specified rectangle with
  3310. the current grafPort's background pattern bkPat (in patCopy mode). The 
  3311. grafPort's pnPat and pnMode are ignored; the pen location is not  
  3312. changed.
  3313. \ InvertOval
  3314. 2
  3315. PROCEDURE InvertOval (r: Rect);
  3316.  
  3317.     InvertOval inverts the pixels enclosed by an oval just inside the
  3318. specified rectangle: every white pixel becomes black and every black
  3319. pixel becomes white. The grafPort's pnPat, pnMode, and bkPat are all 
  3320. ignored; the pen location is not changed.
  3321. \ FillOval
  3322. 2
  3323. PROCEDURE FillOval (r: Rect; pat: Pattern);
  3324.  
  3325.     FillOval fills an oval just inside the specified rectangle with the
  3326. given pattern in patCopy mode). The grafPort's pnPat, pnMode, and 
  3327. bkPat are all ignored; the pen location is not changed.
  3328. \ FrameRoundRect
  3329. 2
  3330. PROCEDURE FrameRoundRect (r: Rect; ovalWidth,ovalHeight: INTEGER);
  3331.  
  3332.     FrameRoundRect draws a hollow outline just inside the specified
  3333. rounded-corner rectangle, using the current grafPort's pen pattern, 
  3334. mode, and size. OvalWidth and ovalHeight specify the diameters of
  3335. curvature for the corners (see Figure 19). The outline is as wide as
  3336. the pen width and as tall as the pen height. It is drawn with the
  3337. pnPat, according to the pattern transfer mode specified by pnMode. The
  3338. pen location is not changed by this procedure.
  3339.  
  3340.     If a region is open and being formed, the outside outline of the new
  3341. rounded-corner rectangle is mathematically added to the region's 
  3342. boundary.
  3343. \ PaintRoundRect
  3344. 2
  3345. PROCEDURE PaintRoundRect (r: Rect; ovalWidth,ovalHeight: INTEGER);
  3346.  
  3347.     PaintRoundREct paints the specified rounded-corner rectangle with
  3348. the current grafPort's pen pattern and mode. OvalWidth and ovalHeight
  3349. specify the diameters of curvature for the corners. The rounded-corner
  3350. rectangle on the bitMap is filled with the pnPat, according to the
  3351. pattern transfer mode specified by pnMode. The pen location is not
  3352. changed by this procedure.
  3353. \ EraseRoundRect
  3354. 2
  3355. PROCEDURE EraseRoundRect (r: Rect; ovalWidth,ovalHeight: INTEGER);
  3356.  
  3357.     EraseRoundRect paints the specified rounded-corner rectangle with
  3358. the current grafPort's background pattern bkPat (in patCopy mode).
  3359.  
  3360.     OvalWidth and ovalHeight specify the diameters of curvature for the
  3361. corners. The grafPort's pnPat and pnMode are ignored; the pen location 
  3362. is not changed.
  3363. \ InvertRoundRect
  3364. 2
  3365. PROCEDURE InvertRoundRect (r: Rect; ovalWidth,ovalHeight: INTEGER);
  3366.  
  3367.     InvertRoundRect inverts the pixels enclosed by the specified
  3368. rounded-corner rectangle: every white pixel becomes black and every
  3369. black pixel becomes white. OvalWidth and ovalHeight specify the
  3370. diameters of curvature for the corners. The grafPort's pnPat, pnMode,
  3371. and bkPat are all ignored; the pen location is not changed.
  3372. \ FillRoundRect
  3373. 2
  3374. PROCEDURE FillRoundRect (r: Rect; ovalWidth,ovalHeight: INTEGER; pat:
  3375.                             Pattern);
  3376.  
  3377.     FillRoundRect fills the specified rounded-corner rectangle with the
  3378. given pattern (in patCopy mode). OvalWidth and ovalHeight specify the
  3379. diameters of curvature for the corners. The grafPort's pnPat, pnMode, 
  3380. and bkPat are all ignored; the pen location is not changed.
  3381. \ FrameArc
  3382. 2
  3383. PROCEDURE FrameArc (r: Rect; startAngle,arcAngle: INTEGER);
  3384.  
  3385.     FrameArc draws an arc of the oval that fits inside the specified
  3386. rectangle, using the current grafPort's pen pattern, mode, and size.
  3387. StartAngle indicates where the arc begins and is treated mod 36Ø.
  3388. ArcAngle defines the extent of the arc. The angles are given in
  3389. positive or negative degrees; a positive angle goes clockwise, while a
  3390. negative angle goes counterclockwis. Zero degrees is at l2 o'clock,
  3391. high, 9Ø (or -27Ø) is at 3 o'clock, 18Ø (or -18Ø) is at 6 o'clock, and
  3392. 27Ø (or -9Ø) is at 9 o'clock. Other angles are measured relative to
  3393. the enclosing rectangle:  a line from the center of the rectangle
  3394. through its top right corner is at 45 degrees, even if the rectangle is
  3395. not square; a line through the bottom right corner is at 135 degrees,
  3396. and so on (see Figure 2Ø).
  3397.  
  3398.     The arc is as wide as the pen width and as tall as the pen height.
  3399. It is drawn with the pnPat, according to the pattern transfer mode
  3400. specified by pnMode. The pen location is not changed by this
  3401. procedure.
  3402.  
  3403. (eye)
  3404.     FrameArc differs from other QuickDraw procedures that
  3405.     frame shapes in that the arc is not mathematically added
  3406.     to the boundary of a region that is open and being
  3407.     formed.
  3408.  
  3409.  
  3410. \ PaintArc
  3411. 2
  3412. PROCEDURE PaintArc (r: Rec; startAngle,arcAngle: INTEGER);
  3413.  
  3414.     PaintArc paints a wedge of the oval just inside the specified
  3415. rectangle with the current grafPort's pen pattern and mode. StartAngle
  3416. and arcAngle define the arc of the wedge as in FrameArc. The wedge on
  3417. the bitMap is filled with the pnPat, according to the pattern transfer
  3418. mode specified by pnMode. The pen location is not changed by this
  3419. procedure.
  3420.  
  3421.  
  3422. \ EraseArc
  3423. 2
  3424. PROCEDURE EraseArc (r: Rect; startAngle,arcAngle: INTEGER);
  3425.  
  3426.     EraseArc paints a wedge of the oval just inside the specified
  3427. rectangle with the current grafPort's background pattern bkPat (in
  3428. patCopy mode). StartAngle and arcAngle define the arc of the wedge as in
  3429. FrameArc. The grafPort's pnPat and pnMode are ignored; the pen location
  3430. is not changed.
  3431. \ InvertArc
  3432. 2
  3433. PROCEDURE InvertArc (r: Rect; startAngle,arcAngle: INTEGER);
  3434.  
  3435.     InvertArc inverts the pixels enclosed by a wedge of the oval just
  3436. inside the specified rectangle:  every white pixel becomes black and
  3437. every black pixel becomes white. StartAngle and arcAngle define the
  3438. arc of the wedge as in FrameArc. The grafPort's pnPat, pnMode, and 
  3439. bkPat are all ignored; the pen location is not changed.
  3440. \ FillArc
  3441. 2
  3442. PROCEDURE FillArc (r: Rect; startAngle,arcAngle: INTEGER; pat:
  3443.     Pattern);
  3444.  
  3445.     FillArc fills a wedge of the oval just inside the specified
  3446. rectangle with the given pattern (in patCopy mode). StartAngle and
  3447. arcAngle define the arc of the wedge as in FrameArc. The grafPort's
  3448. pnPat, pnMode, and bkPat are all ignored; the pen lcoation is not
  3449. changed.
  3450. \ NewRgn
  3451. 2
  3452. FUNCTION NewRgn : RgnHandle;
  3453.  
  3454.     NewRgn allocates space for a new, dynamic, variable-size region,
  3455. initializes it to the empty region (Ø,Ø,Ø,Ø), and returns a handle to
  3456. the new region. Only this function creates new regions; all other
  3457. procedures just alter the size and shape of regions you create.
  3458. OpenPort calls NewRgn to allocate space for the port's visRgn and 
  3459. clipRgn.
  3460.  
  3461. (eye)
  3462.     Except when using visRgn or clipRgn, you MUST call NewRgn
  3463.     before specifying a region's handle in any drawing or 
  3464.     calculation procedure.
  3465.  
  3466. (eye)
  3467.     Never refer to a region without using its handle.
  3468. \ DisposeRgn
  3469. 2
  3470. PROCEDURE DisposeRgn (rgn: RgnHandle);
  3471.  
  3472.     DisposeRgn deallocates space for the region whose handle is supplied
  3473. and returns the memory used by the region to the free memory pool. Use
  3474. this only after you are completely through with a temporary region.
  3475.  
  3476. (eye)
  3477.     Never use a region once you have deallocated it, or you
  3478.     will risk being hung by dangling pointers!
  3479. \ CopyRgn
  3480. 2
  3481. PROCEDURE CopyRgn (srcRgn,dstRgn: RgnHandle);
  3482.  
  3483.     CopyRgn copies the mathematical structure of arcRgn into dstRgn;
  3484. that is, it makes a duplicate copy of srcRgn. Once this is done, srcRgn
  3485. may be altered (or even disposd of) without affecting dstRgn. COPYRGN
  3486. DOES NOT CREATE THE DESTINATION REGION:  you must use NewRgn to create
  3487. the dstRgn before you call CopyRgn.
  3488. \ SetEmptyRgn
  3489. 2
  3490. PROCEDURE SetEmptyRgn (rgn: RgnHandle);
  3491.  
  3492.     Set EmptyRgn destroys the previous structure of the given region,
  3493. then sets the new structure to the empty region (Ø,Ø,Ø,Ø).
  3494. \ SetRectRgn
  3495. 2
  3496. PROCEDURE SetRectRgn (rgn: RgnHandle; left,top,right,bottom: INTEGER);
  3497.  
  3498.     SetRectRgn destroys the previous structure of the given region, then
  3499. sets the new structure to the rectangle specified by left, top, right,
  3500. and bottom.
  3501.  
  3502.     If the specified rectangle is empty (i.e., left>=right or
  3503. top>=Bottom), the region is set to the empty region (Ø,Ø,Ø,Ø).
  3504. \ RectRgn
  3505. 2
  3506. PROCEDURE RectRgn (rgn: RgnHandle; r: Rect);
  3507.  
  3508.     RectRgn destroys the previous structure of the given region, then
  3509. sets the new structure to the rectangle specified by r. This is
  3510. operationally synonymous with SetRectRgn, except the input rectangle is
  3511. defined by a rectangle rather than by four boundary coordinates.
  3512. \ OpenRgn
  3513. 2
  3514. PROCEDURE OpenRgn;
  3515.  
  3516.     OpenRgn tells QuickDraw to allocate temporary space and start saving
  3517. lines and framed shapes for later processing as a region definition.
  3518. While a region is open, all calls to Line, LineTo, and the procedures
  3519. that draw framed shapes (except arcs) affect the outline of the region.
  3520. Only the line endpoints and shape boundaries affect the region
  3521. definition; the pen mode, pattern, and size do not affect it. In fact,
  3522. OpenRgn calls HidePen, so no drawing occurs on the screen while the
  3523. region is open (unless you called ShowPen just after Open Rgn, or you
  3524. called ShowPen previously without balancing it by a call to HidePen).
  3525. Since the pen hangs below and to the right of the pen location, drawing
  3526. lines with even the smallest pen will change bits that lie outside the
  3527. region you define.
  3528.  
  3529.     The outline of a region is mathematically defined and infinitely
  3530. thin, and separates the bitMap into two groups of bits:  those within
  3531. the region and those outside it. A region should consist of one or more
  3532. closed loops. Each framed shape itself constitutes a loop. Any lines
  3533. drawn with Line or LineTo should connect with each other or with a
  3534. framed shape. Even though  the on-screen presentation of a region is
  3535. clipped, the definition of a region is not; you can define a region
  3536. anywhere on the coordinate plane with complete disregard for the
  3537. location of various grafPort entities on that plane.
  3538.  
  3539.     When a region is open, the current grafPort's rgnSave field contains
  3540. a handle to information related to the region definition. If you want
  3541. to temporarily disable the collection of lines and shapes, you can save
  3542. the current value of this field, set the field to NIL, and later
  3543. restore the saved value to resume the region definition.
  3544.  
  3545. (eye)
  3546.     Do not call OpenRgn while another region is already open.
  3547.     All open regions but the most recent will behave
  3548.     strangely.
  3549. \ CloseRgn
  3550. 2
  3551. PROCEDURE CloseRgn (dstRgn: RgnHandle);
  3552.  
  3553.     CloseRgn stops the collection of lines and framed shapes, organizes
  3554. them into a region definition, and saves the resulting region into the
  3555. region indicated by dstRgn. You should perform one and only one
  3556. CloseRgn for every OpnRgn. CloseRgn calls ShowPen, balancing the
  3557. HidePen call made by OpenRgn.
  3558.  
  3559.     Here's an example of how to create and open a region, define a
  3560. barbell shape, close the region, and draw it:
  3561.  
  3562.     barbell := NewRgn;                  {make a new region}
  3563.     OpenRgn;                            {begin collecting stuff}
  3564.        SetRect(tempRect,2Ø,2Ø,3Ø,5Ø);   {form the left weight}
  3565.        FrameOval(tempRect);
  3566.        SetRect(tempRect,3Ø,3Ø,8Ø,4Ø);   {form the bar}
  3567.        FrameRect(tempRect);
  3568.        SetRect(tempRect(8Ø,2Ø,9Ø,5Ø);   {form the right weight}
  3569.        FrameOval(tempRect);
  3570.     CloseRgn(barbell);                  {we're done; save in barbell}
  3571.     FillRgn(barbell,black);             {draw it on the screen}
  3572.     DisposeRgn(barbell);                {we don't need you anymore...}
  3573. \ OffsetRgn
  3574. 2
  3575. PROCEDURE OffsetRgn (rgn: RgnHandle; dh,dv: INTEGER);
  3576.  
  3577.     OffsetRgn moves the region on the coordinate plane, a distance of dh
  3578. horizontally and dv vertically. This does not affect the screen unless
  3579. you subsequently call a routine to draw the region. If dh and dv are
  3580. positive, the movement is to the right and down; if either is negative,
  3581. the corresponding movement is in the opposite direction. The region
  3582. retains its size and shape.
  3583.  
  3584. (hand)
  3585.     OffsetRgn is an especially efficient operation, because
  3586.     most of the data defining a region is stored relative to
  3587.     rgnBBox and so isn't actually changed by OffsetRgn.
  3588. \ InsetRgn
  3589. 2
  3590. PROCEDURE InsetRgn (rgn: RgnHandle; dh,dv: INTEGER);
  3591.  
  3592.     InsetRgn shrinks or expands the region. All points on the region
  3593. boundary are moved inwards a distance of dv vertically and dh
  3594. horizontally; if dh or dv is negative, the points are moved outwards in
  3595. that direction. InsetRgn leaves the region "centered" at the same
  3596. position, but moves the outline in (for positive values of dh and dv)
  3597. or out (for negative values of dh and dv). InsetRgn of a rectangular
  3598. region works just like InsetRect.
  3599. \ SectRgn
  3600. 2
  3601. PROCEDURE SectRgn (srcRgnA,srcRgnB,dstRgn: RgnHandle);
  3602.  
  3603.     SectRgn calculates the intersection of two regions and places the
  3604. intersection in a third region. THIS DOES NOT CREATE THE DESTINATION
  3605. REGION:  you must use NewRgn to create the dstRgn before you call
  3606. SectRgn. The dstRgn can be one of the source regions, if desired.
  3607.  
  3608.     If the regions do not intersect, or one of the regions is empty, the
  3609. destination is set to the empty region (Ø,Ø,Ø,Ø).
  3610. \ UnionRgn
  3611. 2
  3612. PROCEDURE UnionRgn (srcRgnA,srcRgnB,dstRgn: RgnHandle);
  3613.  
  3614.     UnionRgn calculates the union of two regions and places the union in
  3615. a third region. THIS DOES NOT CREATE THE DESTINATION REGION:  you must
  3616. use NewRgn to create the dstRgn before you call UnionRgn. The dstRgn
  3617. can be one of the source regions, if desired.
  3618.  
  3619.     If both regions are empty, the destination is set to the empty
  3620. region (Ø,Ø,Ø,Ø).
  3621. \ DiffRgn
  3622. 2
  3623. PROCEDURE DiffRgn (srcRgnA,srcRgnB,dstRgn: RgnHandle);
  3624.  
  3625.     DiffRgn subtracts  srcRgnB from srcRgnA and places the difference in
  3626. a third region. THIS DOES NOT CREATE THE DESTINATION REGION:  You must
  3627. use NewRgn to create the dstRgn before you call DiffRgn. The dstRgn
  3628. can be one of the source regions, if desired.
  3629.  
  3630.     If the first source region is empty, the destination is set to the
  3631. empty region (Ø,Ø,Ø,Ø).
  3632. \ XorRgn
  3633. 2
  3634. PROCEDURE XorRgn (srcRgnA,srcRgnB,dstRgn: RgnHandle);
  3635.  
  3636.     XorRgn calculates the difference between the union and the
  3637. intersection of two regions and places the result in a third region.
  3638. THIS DOES NOT CREATE THE DESTINATION REGION:  you must use NewRgn to
  3639. create the dstRgn before you call XorRgn. The dstRgn can be one of the
  3640. source regions, if desired.
  3641.  
  3642.     If the regions are coincident, the destination is set to the empty
  3643. region (Ø,Ø,Ø,Ø).
  3644. \ PtInRgn
  3645. 2
  3646. FUNCTION PtInRgn (pt: Point; rgn: RgnHandle) : BOOLEAN;
  3647.  
  3648.     PtInRgn checks whether the pixel below and to the right of the given
  3649. coordinate point is within the specified region, and returns TRUE if so
  3650. or FALSE if not.
  3651. \ RectInRgn
  3652. 2
  3653. FUNCTION RectInRgn (r: Rect; rgn: RgnHandle) : BOOLEAN;
  3654.  
  3655.     RectInRgn checks whether the given rectangle intersects the
  3656. specified region, and returns TRUE if the intersection encloses at least one bit
  3657. or FALSE if not.
  3658. \ EqualRgn
  3659. 2
  3660. FUNCTION EqualRgn (rgnA,rgnB: RgnHandle) : BOOLEAN;
  3661.  
  3662. EqualRgn compares the two regions and returns TRUE if they are equal
  3663. or FALSE if not. The two regions must have identical sizes, shapes, and
  3664. locations to be considered equal. Any two empty regions are always
  3665. equal.
  3666. \ EmptyRgn
  3667. 2
  3668. FUNCTION EmptyRgn (rgn: RgnHandle) : BOOLEAN;
  3669.  
  3670.     EmptyRgn returns TRUE if the region is an empty region or FALSE if
  3671. not. Some of the circumstances in which an empty region can be created
  3672. are: a NewRgn call; a CopyRgn of an empty region; a SetRectRgn or
  3673. RectRegn with an empty rectangle as an argument; CloseRgn without a
  3674. previous OpenRgn or with no drawing after an OpenRgn; OffsetRgn of an
  3675. empty region; InsetRgn with an empty region or too large an inset;
  3676. SectRgn of nonintersecting regions; UnionRgn of two empty regions; and
  3677. DiffRgn or XorRgn of two identical or nonintersecting regions.
  3678. \ FrameRgn
  3679. 2
  3680. PROCEDURE FrameRgn (rgn: RgnHandle);
  3681.  
  3682.     FrameRgn draws a hollow outline just inside the specified region,
  3683. using the current grafPort's pen pattern, mode, and size. The outline
  3684. is as wide as the pen width and as tall as the pen height; under no
  3685. circumstances will the frame go outside the region boundary. The pen
  3686. location is not changed by this procedure.
  3687.  
  3688.     If a region is open and being formed, the outside outline of the
  3689. region being framed is mathematically added to that region's boundary.
  3690. \ PaintRgn
  3691. 2
  3692. PROCEDURE PaintRgn (rgn: RgnHandle);
  3693.  
  3694.     PaintRgn paints the specified region with the current grafPort's pen 
  3695. pattern and pen mode. The region on the bitMap is filled with the
  3696. pnPat, according to the pattern transfer mode specified by pnMode. The
  3697. pen location is not changed by this procedure.
  3698. \ EraseRgn
  3699. 2
  3700. PROCEDURE EraseRgn (rgn: RgnHandle);
  3701.  
  3702.     EraseRgn paints the specified region with the current grafPort's
  3703. background pattern bkPat (in patCopy mode). The grafPort's pnPat and 
  3704. pnMode are ignored; the pen location is not changed.
  3705. \ InvertRgn
  3706. 2
  3707. PROCEDURE InvertRgn (rgn: RgnHandle);
  3708.  
  3709.     InvertRgn inverts the pixels enclosed by the specified region: every
  3710. white pixel becomes black and every black pixel becomes white. The
  3711. grafPort's pnPat, pnMode, and bkPat are all ignored; the pen lcoation 
  3712. is not changed.
  3713. \ FillRgn
  3714. 2
  3715. PROCEDURE FillRgn (rgn: RgnHandle; pat: Pattern);
  3716.  
  3717.     FillRgn fills the specified region with the given pattern (in
  3718. patCopy mode). The grafPort's pnPat, pnMode, and bkPat are all ignored;
  3719. the pen location is not changed.
  3720. \ ScrollRect
  3721. 2
  3722. PROCEDURE ScrollRect (r: Rect; dh,dv: INTEGER; updateRgn: RgnHandle);
  3723.  
  3724.     ScrollRect shifts ("scrolls") those bits inside the intersection of
  3725. the specified rectangle, visRgn, clipRgn, portRect, and portBits.bounds.
  3726. The bits are shifted a distance of dh horizontally and dv vertically.
  3727. The positive directions are to the right and down. No other bits are
  3728. affected. Bits that are shifted out of the scroll area are lost; they
  3729. are neither placed outside the area nor saved. The grafPort's
  3730. background pattern bkPat fills the space created by the scroll. In
  3731. addition, updateRgn is changed to the area filled with bkPat (see
  3732. Figure 21).
  3733.  
  3734.     Figure 21 shows that the pen location after a ScrollRect is in a
  3735. different position relative to what was scrolled in the rectangle. The
  3736. entire scrolled item has been moved to different coordinates. To
  3737. restore it to its coordinates before the ScrollRect, you can use the
  3738. SetOrigin procedure. For example, suppose the dstRect here is the
  3739. portRect of the grafPort and its top left corner is at (95,12Ø).
  3740. SetOrigin(1Ø5,115) will offset the coordinate system to compensate for
  3741. the scroll. Since the clipRgn and pen lcoation are not offset, they
  3742. move down and to the left.
  3743. \ CopyBits
  3744. 2
  3745. PROCEDURE CopyBits (srcBits,dstBits: BitMap; srcRect,dstRect: Rect;
  3746.         mode: INTEGER; maskRgn: RgnHandle);
  3747.  
  3748.     CopyBits transfers a bit image between any two bitMaps and clips the
  3749. result to the area specified by the maskRgn parameter. The transfer
  3750. may be performed in any of the eight source transfer modes. The result
  3751. is always clipped to the maskRgn and the boundary rectangle of the
  3752. destination bitMap; if the destination bitMap is the current grafPort's 
  3753. portBits, it is also clipped to the intersection of the grafPort's 
  3754. clipRgn and visRgn. If you do not want to clip to a maskRgn, just pass
  3755. NIL for the maskRgn parameter.
  3756.  
  3757.     The dstRect and maskRgn coordinates are in terms of the
  3758. dstBits.bounds coordinate system, and the src Rect coordinates are in
  3759. terms of the srcBits.bounds coordinates.
  3760.  
  3761.     The bits enclosed by the source rectangle are transferred into the
  3762. destination rectangle according to the rules of the chosen mode. The
  3763. source transfer modes are as follows:
  3764.  
  3765.     srcCopy     srcXor      notSrcCopy  notSrcXor
  3766.     srcOr       srcBic      notSrcOr    notSrcBic
  3767.  
  3768.     The source rectangle is completely aligned with the destination
  3769. rectangles; if the rectangles are of different sizes, the bit image is
  3770. expanded or shrunk as necessary to fit the destination rectangle. For
  3771. example, if the bit image is a circle in a square source rectangle, and
  3772. the destination rectangle is not square, the bit image appears as an
  3773. oval in the destination (see Figure 22).
  3774. \ OpenPicture
  3775. 2
  3776. FUNCTION  OpenPicture (picFrame: Rect) : PicHandle;
  3777.  
  3778.     OpenPicture returns a hendle to a new picture  which has the given
  3779. rectangle as its picture frame, and tells QuickDraw to start saving as
  3780. the picture definition all calls to drawing routines and all picture
  3781. comments (if any).
  3782.  
  3783.     OpenPicture calls HidePen, so no drawing occurs on the screen while
  3784. the picture is open (unless you call ShowPen just after OpenPicture, or
  3785. you called ShowPen previously without balancing it by a call to HidePen)
  3786.  
  3787.     When a picture is open, the current grafPort's picSave field
  3788. contains a handle to information related to the picture definition. If
  3789. you want to temporarily disable the collection of routine calls and
  3790. picture comments, you can save the current value of this field, set the
  3791. field to NIL, and later restore the saved value to resume the picture
  3792. definition.
  3793.  
  3794. (eye)
  3795.     Do not call OpenPicture while another picture is already
  3796.     open.
  3797. \ ClosePicture
  3798. 2
  3799. PROCEDURE ClosePicture;
  3800.  
  3801.     ClosePicture tells QuickDraw to stop saving routine calls and
  3802. picture comments as the definition of the currently open picture. You
  3803. should perform one and only one ClosePicture for every OpenPicture.
  3804. ClosePicture calls ShowPen, balancing the HidePen call made by
  3805. OpenPicture.
  3806. \ PicComment
  3807. 2
  3808. PROCEDURE PicComment (kind,dataSize: INTEGER; dataHandle: QDHandle);
  3809.  
  3810.     PicComment inserts the specified comment into the definition of the
  3811. currently open picture.  Kind identifies the type of comment.
  3812. DataHandle is a handle to additional data if desired, and dataSize is
  3813. the size of that data in bytes. If there is no additional data for the
  3814. comment, dataHandle should be NIL and dataSize should be Ø. The
  3815. application that processes the comment must include a procedure to do
  3816. the processing and store a pointer to the procedure in the data
  3817. structure pointed to by the grafProcs field of the grafPort (see
  3818. "Customizing QuickDraw Operations").
  3819. \ DrawPicture
  3820. 2
  3821. PROCEDURE DrawPicture (myPicture: PicHandle; dstRect: Rect);
  3822.  
  3823.     DrawPicture draws the given picture to scale in dstRect, expanding
  3824. or shrinking it as necessary to align the borders of the picture frame
  3825. with dstRect. DrawPicture passes any picture comments to the procedure
  3826. accessed indirectly through the grafProcs field of the grafPort (see
  3827. PicComment above).
  3828. \ KillPicture
  3829. 2
  3830. PROCEDURE KillPicture (myPicture: PicHandle);
  3831.  
  3832.     KillPicture deallocates space for the picture whose handle is
  3833. supplied, and returns the memory used by the picture to the free memory
  3834. pool. Use this only when you are completely through with a picture.
  3835. \ OpenPoly
  3836. 2
  3837. FUNCTION OpenPoly : PlyHandle;
  3838.  
  3839.     OpenPoly returns a handle to a new polygon and tells QuickDraw to
  3840. start saving the polygon definition as specified by calls to
  3841. line-drawing routines. While a polygon is open, all calls to Line and
  3842. LineTo affect the outline of the polygon. Only the line endpoints
  3843. affect the polygon definition; the pen mode, pattern, and size do not
  3844. affect it. In fact OpenPoly calls HidePen, so no drawing occurs on the
  3845. screen while the polygon is open (unless you call ShowPen just after
  3846. OpenPoly, or you called ShowPen previously without balancing it by a
  3847. call to HidePen).
  3848.  
  3849.     A polygon should consist of a sequence of connected lines. Even
  3850. though the on-screen presentation of a polygon is clipped, the
  3851. definition of a polygon is not; you can define a polygon anywhere on the
  3852. coordinate plane with complete disregard for the location of various
  3853. grafPort entities on that plane.
  3854.  
  3855.     When a polygon is open, the current grafPort's polySave field
  3856. contains a handle to information related to the polygon definition. If
  3857. you want to temprarily disable the polygon definition, you can save the
  3858. current value of this field, set the field to NIL, and later restore the
  3859. saved value to resume the polygon definition.
  3860.  
  3861. (eye)
  3862.     Do not call OpenPoly while another polygon is already
  3863.     open.
  3864. \ ClosePoly
  3865. 2
  3866. PROCEDURE ClosePoly;
  3867.  
  3868.     ClosePoly tells QuickDraw to stop saving the definition of the
  3869. currently open polygon and computes the polyBBox rectangle. You should
  3870. perform one and only one ClosePoly for every OpenPoly. ClosePoly calls
  3871. ShowPen, balancing the HidePen call made by OpenPoly.
  3872.  
  3873.     Here's an example of how to open a polygon, define it as a triangle, 
  3874. close it, and draw it:
  3875.  
  3876.     triPoly := OpenPoly;    {save handle and begin collecting stuff}
  3877.       MoveTo (3ØØ,1ØØ);     { move to first point and }
  3878.       LineTo(4ØØ,2ØØ);      {      form       }
  3879.       LineTo(2ØØ,2ØØ);      {       the           }
  3880.       LineTo(3ØØ,1ØØ);      {     triangle    }
  3881.     ClosePoly;              {stop collecting stuff}
  3882.     FillPoly(triPoly,gray); {draw it on the screen}
  3883.     KillPoly(triPoly);      {we're all done}
  3884. \ KillPoly
  3885. 2
  3886. PROCEDURE KillPoly (poly: PolyHandle);
  3887.  
  3888.     KillPoly deallocates space for the polygon whose handle is supplied,
  3889. and returns the memory used by the polygon to the free memory pool.
  3890. Use this only after you are completely through with a polygon.
  3891. \ OffsetPoly
  3892. 2
  3893. PROCEDURE OffsetPoly (poly: PolyHandle; dh,dv: INTEGER);
  3894.  
  3895.     OffsetPoly moves the polygon on the coordinate plane, a distance of
  3896. dh horizontally and dv vertically. This does not affect the screen
  3897. unless your subsequently call a routine to draw the polygon. If dh and
  3898. dv are positive, the movement is to the right and down; if either is
  3899. negative, the corresponding movement is in the opposite direction. The
  3900. polygon retains its shape and size.
  3901.  
  3902. (hand)
  3903.     OffsetPoly is an especially efficient operation, because
  3904.     the data defining a polygon is stored relative to
  3905.     polyStart and so isn't actually changed by OffsetPoly.
  3906. \ FramePoly
  3907. 2
  3908. PROCEDURE FramePoly (poly: PolyHandle);
  3909.  
  3910.     FramePoly plays back the line-drawing routine calls that define the
  3911. given polygon, using the current grafPort's pen pattern, mode, and 
  3912. size. The pen will hang below and to the right of each point on the
  3913. boundary of the polygon; thus, the polygon drawn will extend beyond the
  3914. right and bottom edges of poly^^.polyBBox by the pen width and pen
  3915. height, respectively. All other graphic operations occur strictly
  3916. within the boundary of the polygon, as for other shapes. You can see
  3917. this difference in Figure 23, where each of the polygons is shown with
  3918. its polyBBox.
  3919.  
  3920.     If a polygon is open and being formed, FramePoly affects the outline
  3921. of the polygon just as if the line-drawing routines themselves had been
  3922. called. If a region is open and being formed, the outside outline of
  3923. the polygon being framed is mathematically added to the region's
  3924. boundary.
  3925. \ PaintPoly
  3926. 2
  3927. PROCEDURE PaintPoly (poly: PolyHandle);
  3928.  
  3929.     PaintPoly paints the specified polygon with the current grafPort's
  3930. pen pattern and pen mode. The polygon on the bitMap is filled with the
  3931. pnPat, according to the pattern transfer mode specified by pnMode. The
  3932. pen location is not changed by this procedure.
  3933. \ ErasePoly
  3934. 2
  3935. PROCEDURE ErasePoly (poly: PolyHandle);
  3936.  
  3937.     ErasePoly paints the specified polygon with the current grafPort's 
  3938. background pattern bkPat (in patCopy mode). The pnPat and pnMode are
  3939. ignored; the pen location is not changed.
  3940. \ InvertPoly
  3941. 2
  3942. PROCEDURE InvertPoly (poly: PolyHandle);
  3943.  
  3944.     InvertPoly inverts the pixels enclosed by the specified polygon:
  3945. every white pixel becomes black and every black pixel becomes white. The
  3946. grafPort's pnPat, pnMode, and bkPat are all ignored; the pen location
  3947. is not changed.
  3948. \ FillPoly
  3949. 2
  3950. PROCEDURE FillPoly (poly: PolyHandle; pat: Pattern);
  3951.  
  3952.     FillPoly fills the specified polygon with the given pattern (in
  3953. patCopy mode.)  The grafPort's pnPat, pnMode, and bkPat are all ignored;
  3954. the pen location is not changed.
  3955. \ AddPt
  3956. 2
  3957. PROCEDURE AddPt (srcPt: Point; VAR dstPt: Point);
  3958.  
  3959.     AddPt adds the coordinates of srcPt to the coordinates of dstPt, and
  3960. returns the result in dstPt.
  3961. \ SubPt
  3962. 2
  3963. PROCEDURE SubPt (srcPt: Point; VAR dstPt: Point);
  3964.  
  3965.     SubPt subtracts the coordinates of srcPt from the coordinates of
  3966. dstPt, and returns the result in dstPt.
  3967. \ SetPt
  3968. 2
  3969. PROCEDURE SetPt (VAR pt: Point; h,v: INTEGER);
  3970.  
  3971.     SetPt assigns two integer coordinates to a variable of type Point.
  3972. \ EqualPt
  3973. 2
  3974. FUNCTION EqualPt (ptA,ptB: Point) : BOOLEAN;
  3975.  
  3976.     EqualPt compares the two points and returns true if they are equal
  3977. or FALSE if not.
  3978. \ LocalToGlobal
  3979. 2
  3980. PROCEDURE LocalToGlobal (VAR pt: Point);
  3981.  
  3982.     LocalToGlobal converts the given point from the current grafPort's
  3983. local coordinate system into a global coordinate system with the origin
  3984. (Ø,Ø) at the top left corner of the port's bit image (such as the 
  3985. screen). This global point can then be compared to other global
  3986. points, or be changed into the local coordinates of another grafPort.
  3987.  
  3988.     Since a rectangle is defined by two points, you can convert a
  3989. rectangle into global coordinates by performing two LocalToGlobal calls,
  3990. You can also convert a rectangle, region, or polygon into global
  3991. coordinates by calling OffsetRect, OffsetRgn, or OffsetPoly. For
  3992. examples, see GlobalToLocal below.
  3993. \ GlobalToLocal
  3994. 2
  3995. PROCEDURE GlobalToLocal (VAR pt: Point);
  3996.  
  3997.     GlobalToLocal takes a point expressed in global coordinates (with
  3998. the top left corner of the bitMap as coordinate (Ø,Ø)) and converts it
  3999. into the local coordinates of the current grafPort. The global point
  4000. can be obtained with the LocalToGlobal call (see above). For example,
  4001. suppose a game draws a "ball" within a rectangle named ballRect, defined
  4002. in the grafPort named gamePort (as illustrated below in Figure 24). If
  4003. you want to draw that ball in the grafPort named selectPort, you can
  4004. calculate the ball's selectPort coordinates like this:
  4005.  
  4006.     SetPort(gamePort);                  {start in origin port}
  4007.     selectBall:= ballRect;              {make a copy to be moved}
  4008.     LocalToGlobal(selectBall.topLeft);  {put both corners into }
  4009.     LocalToGlobal(selectBall.botRight); {  global coordinates  }
  4010.  
  4011.     SetPort(selectPort);                {switch to destination port}
  4012.     GlobalToLocal(selectBall.topLeft);  {put both corners into     }
  4013.     GlobalToLocal(selectBall.botRight); {  these local coordinates }
  4014.     FillOval(selectBall,ballColor);     {now you have the ball!}
  4015.  
  4016.     You can see from Figure 24 that LocalToGlobal and GlobalToLocal
  4017. simply offset the coordinates of the rectangle by the coordinates of the
  4018. top left corner of the local grafPort's boundary rectangle. You could
  4019. also do this with OffsetRect. In fact the way to convert regions and
  4020. polygons from one coordinate system to another is with OffsetRgn or
  4021. OffsetPoly rather than LocalToGlobal and GlobalToLocal. For example,
  4022. if myRgn were a region enclosed by a rectangle having the same
  4023. coordinates as ballRect in gamePort, you could convert the region to
  4024. global coordinates with
  4025.  
  4026.     OffsetRgn(myRgn, -2Ø, -4Ø);
  4027.  
  4028. and then convert it to the coordinates of the selectPort grafPort with
  4029.  
  4030.     OffsetRgn(myRgn, l5, -3Ø);
  4031. \ Random
  4032. 2
  4033. FUNCTION Random : INTEGR;
  4034.  
  4035.     This function returns an integer, uniformly distributedpseudo-
  4036. random, in the range from -32768 through 32767. The value returned
  4037. depends on the global variable randSeed, which InitGraf initializes to
  4038. 1; you can start the sequence over again from where it began by
  4039. resetting randSeed to 1.
  4040. \ GetPixel
  4041. 2
  4042. FUNCTION GetPixel (h,v: INTEGER) : BOOLEAN;
  4043.  
  4044.     GetPixel looks at the pixel associated with the given coordinate
  4045. point and returns TRUE if it is black or FALSE if it is white. The
  4046. selected pixel is immediately below and to the right of the point whose
  4047. coordinates are given in h and v, in the local coordinates of the
  4048. current grafPort. There is no guarantee that the specified pixel
  4049. actually belongs to the port, however; it may have been drawn by a port
  4050. overlapping the current one. To see if the point indeed belongs to the
  4051. current port, perform a PtInRgn(pt,thePort^.visRgn).
  4052. \ StuffHex
  4053. 2
  4054. PROCEDURE StuffHex (thingPtr: QDPtr; s: Str255);
  4055.  
  4056.     StuffHex pokes bits (expressed as a string of hexadecimal digits)
  4057. into any data structure. This is a good way to create cursors, patterns,
  4058. or bit images to be "stamped" onto the screen with CopyBits. For
  4059. example,
  4060.  
  4061.     StuffHex(@stripes,'Ø1Ø2Ø4Ø81Ø2Ø4Ø8Ø')
  4062.  
  4063. places a striped pattern into the pattern variable stripes.
  4064.  
  4065. (eye)
  4066.     There is no range checking on the size of the destination
  4067.     variable. It's easy to overrun the variable and destroy 
  4068.     something if you don't know what you're doing.
  4069. \ ScalePt
  4070. 2
  4071. PROCEDURE ScalePt (VAR pt: Point; srcRect,dstRect: Rect);
  4072.  
  4073.     A width and height are passed in pt; the horizontal component of pt
  4074. is the width, and the vertical component of pt is the height. ScalePt
  4075. scales these measurements as follows and returns the result in pt: it
  4076. multiplies the given width by the ratio of dstRect's width to srcRect's
  4077. width, and multiplies the given height by the ratio of dstRec's height 
  4078. to srcRect's height. In Figure 25, where dstRect's width is twice
  4079. srcRect's width and its height is three times srcRect's height, the pen
  4080. width is scaled from 3 to 6 and the pen height is scaled from 2 to 6.
  4081. \ MapPt
  4082. 2
  4083. PROCEDURE MapPt (VAR pt: Point; srcRect,dstRect: Rect);
  4084.  
  4085.     Given a point within srcRect, MapPt maps it to a similarly located
  4086. point within dstRect (that is, to where it would fall if it were part
  4087. of a drawing being expanded or shrunk to fit dstRect). The result is
  4088. returned in pt. A corner point of srcRect would be mapped to the
  4089. corresponding corner point of dstRect, and the center of srcRect to the
  4090. center of dstRect. In Figure 25 above, the point (3.2) in srcRect is
  4091. mapped to (l8,7) in dstRect. FromRect and dstRect may overlap, and pt
  4092. need not actually be within srcRect.
  4093.  
  4094. (eye)
  4095.     Remember, if you are going to draw inside the rectangle
  4096.     in dstRect, you will probably also want to scale the pen
  4097.     size accordingly with ScalePt.
  4098. \ MapRect
  4099. 2
  4100. PROCEDURE MapRect (VAR r: Rect; srcRect,dstRect: Rect);
  4101.  
  4102.     Given a rectangle within srcRect, MapRect maps it to a similarly
  4103. located rectangle within dstRect by calling MapPt to map the top left
  4104. and bottom right corners of the rectangle. The result is returned in
  4105. r.
  4106. \ MapRgn
  4107. 2
  4108. PROCEDURE MapRgn (rgn: RgnHandle; srcRect: Rect);
  4109.  
  4110.     Given a region within srcRec, MapRgn maps it to a similarly located
  4111. region within dstRect by calling MapPt to map all the points in the
  4112. region.
  4113. \ MapPoly
  4114. 2
  4115. PROCEDURE MapPoly (poly: PolyHandle; srcRect,dstRect: Rect);
  4116.  
  4117.     Given a polygon within srcRect, MapPoly maps it to a similarly
  4118. located polygon within dstRect by calling MapPt to map all the pointsthat
  4119. define the polygon.
  4120. \ SetStdProcs
  4121. 2
  4122. PROCEDURE SetStdProcs (VAR procs: QDProcs);
  4123.  
  4124.     This procedure sets all the fields of the given QDProcs record to
  4125. point to the standard low-level routines. You can then change the ones
  4126. you wish to point to your own routines. For example, if your procedure
  4127. that processes picture comments is named MyComments, you will store
  4128. @MyComments in the commentProc field of the QD Procs record.
  4129.  
  4130.     The routines you install must of course have the same calling
  4131. sequences as the standard routines, which are described below. The
  4132. standard drawing routines tell which graphic operation to perform from a
  4133. parameter of type GrafVerb.
  4134.  
  4135.     TYPE GrafVerb = (frame, paint, erase, invert, fill);
  4136.  
  4137.     When the grafVerb is fill, the pattern to use when filling is passed
  4138. in the fillPat field of the grafPort.
  4139. \ StdText
  4140. 2
  4141. PROCEDURE StdText (byteCount: INTEGER; textBuf: QDPtr; numer,denom:
  4142.         INTEGER);
  4143.  
  4144.     StdText is the standard low-level routine for drawing text. It draws
  4145. text from the arbitrary structure in memory specified by textBuf,
  4146. starting from the first byte and continuing for byteCount bytes. Numer
  4147. and denom specify the scaling, if any:  numer.v over denom.v gives the
  4148. vertical scaling, and numer.h over denom.h gives the horizontal
  4149. scaling.
  4150. \ StdLine
  4151. 2
  4152. PROCEDURE StdLine (newPt: Point);
  4153.  
  4154.     StdLine is the standard low-level routine for drawing a line. It
  4155. draws a line from the current pen location to the location specified (in
  4156. local coordinates) by newPt.
  4157. \ StdRect
  4158. 2
  4159. PROCEDURE StdRect (verb; r: Rect);
  4160.  
  4161.     StdRect is the standard low-level routine for drawing a rectangle.
  4162. It draws the given rectangle according to the specified grafVerb.
  4163. \ StdRRect
  4164. 2
  4165. PROCEDURE StdRRect (verb: GrafVerb; r: Rect; ovalwidth,ovalHeight:
  4166.                     INTEGER);
  4167.  
  4168.     StdRrect is the standard low-level routine for drawing a rounded-
  4169. corner rectangle. It draws the given rounded-corner rectangle according
  4170. to the specified grafVerb. OvalWidth and ovalHeight specify the
  4171. diameters of curvature for the corners.
  4172. \ StdOval
  4173. 2
  4174. PROCEDURE StdOval (verb: GrafVerb; r: Rect);
  4175.  
  4176.     StdOval is the standard low-level routine for drawing an oval. It
  4177. draws an oval inside the given rectangle according to the specified
  4178. grafVerb.
  4179. \ StdArc
  4180. 2
  4181. PROCEDURE StdArc (verb: GrafVerb; r: Rect; startAngle,arcAngle:
  4182.                     INTEGER);
  4183.  
  4184.     StdArc is the standard low-level routine for drawing an arc or a
  4185. wedge. It draws an arc or wedge of the oval that fits inside the given
  4186. rectangle. The grafVerb specifies the graphic operation; it it's the 
  4187. frame operation, an arc is drawn; otherwise, a wedge is drawn.
  4188. \ StdPoly
  4189. 2
  4190. PROCEDURE StdPoly (verb: GrafVerb; poly: PolyHandle);
  4191.  
  4192.     StdPoly is the standard low-level routine for drawing a polygon. It
  4193. draws the given polygon according to the specified grafVerb.
  4194. \ StdRgn
  4195. 2
  4196. PROCEDURE StdRgn (verb: GrafVerb; rgn: RgnHandle);
  4197.  
  4198.     StdRgn is the standard low-level routine for drawing a region. It
  4199. draws the given region according to the specified grafVerb.
  4200. \ StdBits
  4201. 2
  4202. PROCEDURE StdBits (VAR srcBits: BitMap; VAR srcRect,dstRect: Rect;
  4203.                     mode: INTEGER; maskRgn: RgnHandle);
  4204.  
  4205.     StdBits is the standard low-level routine for doing bit transfer.It
  4206. transfers a bit image between the given bitMap and thePort^.portBits,
  4207. just as if CopyBits were called with the same parameters and with a
  4208. destination bitMap equal to thePort^.portBits.
  4209. \ StdComment
  4210. 2
  4211. PROCEDURE StdComment (kind,dataSize: INTEGER; dataHandle: QDHandle);
  4212.  
  4213.     StdComment is the standard low-level routine for processing a
  4214. picture comment. Kind identifies the type of comment. DataHandle is a
  4215. handle to additional data, and dataSize is the size of that data in
  4216. bytes. If there is no additional data for the command, dataHandle will
  4217. be NIL and dataSize will be Ø. StdComment simply ignores the comment.
  4218. \ StdTxMeas
  4219. 2
  4220. FUNCTION StdTxMeas (byteCount: INTEGER; textBuf: QDPtr; VAR
  4221.                     numer,denom: Point; VAR info: FontInfo) : INTEGER;
  4222.  
  4223.     StdTxMeas is the standard low-level routine for measung text width.
  4224. It returns the width of the text stored in the arbitrary structure in
  4225. memory specified by textBuf, starting with the first byte and
  4226. continuing for byteCount bytes. Numer and denom specify the scaling as
  4227. in the StdText procedure; note that StdTxMeas may change them.
  4228. \ StdGetPic
  4229. 2
  4230. PROCEDURE StdGetPic (dataPtr: QDPtr; byteCount: INTEGER);
  4231.  
  4232.     StdGetPic is the standard low-level routine for retrieving
  4233. information from the definition of a picture. It retrieves the next
  4234. byteCount bytes from the definition of the currently open picture and
  4235. stores them in the data structure pointed to by dataPtr.
  4236. \ StdPutPic
  4237. 2
  4238. PROCEDURE StdPutPic (dataPtr: QdPtr; byteCount: INTEGER);
  4239.  
  4240.     StdPutPic is the standard low-level routine for saving information
  4241. as the definition of a picture. It saves as the definition of the
  4242. currently open picture the drawing commands stored in the data
  4243. structure pointed to by dataPtr, starting with the first byte and
  4244. continuing for the next byteCount bytes.
  4245. \ SeedFill
  4246. 2
  4247. PROCEDURE SeedFill (srcPtr,dstPtr: Ptr; srcRow, dstRow, height,
  4248.                     words,seedH,seedV: INTEGER);
  4249.  
  4250.     Given a source bit image, SeedFill computes a destination bit image
  4251. with 1’s only in the pixels where paint can leak from the starting
  4252. seed point, like the MacPaint paint-bucket tool. SeedH and seedV
  4253. specify horizontal and vertical offsets, in pixels, from the beginning
  4254. of the data pointed to by dstPtr, determining how far into the
  4255. destination bit image filling should begin. Calls to SeedFill are not
  4256. clipped to the current port and are not stored into QuickDraw pictures.
  4257. \ CalcMask
  4258. 2
  4259. PROCEDURE CalcMask (srcPtr,dstPtr: Ptr; srcRow, dstRow, height,
  4260.                     words: INTEGER);
  4261.  
  4262.     Given a source bit image, CalcMask computes a destination bit image
  4263. with 1’s only in the pixels where paint could not leak from any of
  4264. the outer edges, like the MacPaint lasso tool. Calls to CalcMask are
  4265. not clipped to the current port and are not stored into QuickDraw
  4266. pictures.
  4267. \ CopyMask
  4268. 2
  4269. PROCEDURE CopyMask (srcBits,maskBits,dstBits: BitMap; srcRect,
  4270.                     maskRect,dstRect: Rect);
  4271.  
  4272.     CopyMask is a new version of the CopyBits procedure; it transfers a
  4273. bit image from the source bitmap to the destination bitmap only where
  4274. the corresponding bit of the mask rectangle is a 1. (Note that
  4275. the mask is specified as a rectangle instead of as a handle to a region.)  It can be used along with CalcMask to implement the lasso copy as in MacPaint; it’s also useful for drawing icons. CopyMask doesn’t check for overlap between the source and destina
  4276. \ MeasureText
  4277. 2
  4278. PROCEDURE MeasureText (count: INTEGER; textAddr,charLocs: Ptr);
  4279.  
  4280.     This procedure is designed to improve performance in specialized
  4281. applications such as word processors by providing an array version of
  4282. the TextWidth function; it’s like calling TextWidth repeatedly for a
  4283. given set of characters. TextAddr points to an arbitrary piece of text
  4284. in memory, and count specifies how many characters are to be measured.
  4285.  
  4286.     MeasureText moves along the string and, for each character, computes
  4287. the distance from TextAddr to the right edge of the character.
  4288. CharLocs should point to an array of count + 1 integers. Upon return,
  4289. the first element in the array will always contain 0; the other elements
  4290. will contain pixel positions on the screen for all of the specified
  4291. characters.
  4292.  
  4293. Note:   MeasureText only works with text displayed on the screen;
  4294.         since it doesn’t go through the QuickDraw procedure StdText, it
  4295.         can’t be used to measure text to be printed.
  4296.  
  4297. \ GetMaskTable
  4298. 2
  4299.     The function GetMaskTable, accessible only from assembly language,
  4300. returns in register A0 a pointer to a ROM table containing the following
  4301. useful masks:
  4302.  
  4303. .WORD $0000,$8000,$C000,$E000   ;Table of 16 right masks
  4304. .WORD $F000,$F800,$FC00,$FE00
  4305. .WORD $FF00,$FF80,$FFC0,$FFE0
  4306. .WORD $FFF0,$FFF8,$FFFC,$FFFE
  4307.  
  4308. .WORD $FFFF,$7FFF,$3FFF,$1FFF   ;Table of 16 left masks
  4309. .WORD $0FFF,$07FF,$03FF,$01FF
  4310. .WORD $00FF,$007F,$003F,$001F
  4311. .WORD $000F,$0007,$0003,$0001
  4312.  
  4313. .WORD $8000,$4000,$2000,$1000   ;Table of 16 bit masks
  4314. .WORD $0800,$0400,$0200,$0100
  4315. .WORD $0080,$0040,$0020,$0010
  4316. .WORD $0008,$0004,$0002,$0001
  4317.  
  4318. _GetMaskTable : Macro Name.
  4319. \ InitFonts
  4320. 3
  4321. PROCEDURE InitFonts;
  4322.  
  4323.     InitFonts initializes the Font Manager. If the system font isn't
  4324. already in memory, InitFonts reads it into memory. Call this procedure
  4325. once before all other Font Manager routines or any Toolbox routine that
  4326. will call the Font Manager.
  4327. \ GetFontName
  4328. 3
  4329. PROCEDURE GetFontName (fontNum: INTEGER; VAR theName: Str255);
  4330.  
  4331.     GetFontName returns in theName the name of the font having the font
  4332. number fontNum. If there's no such font, GetFontName returns the empty
  4333. string.
  4334. \ GetFNum
  4335. 3
  4336. PROCEDURE GetFNum (fontName: Str255; VAR theNum: INTEGER);
  4337.  
  4338.     GetFNum returns in theNum the font number for the font having the
  4339. given fontName. If there's no such fone getFNum returns Ø.
  4340. \ RealFont
  4341. 3
  4342. FUNCTION RealFont (fontNum: INTEGER; size: INTEGER) : BOOLEAN;
  4343.  
  4344.     RealFont returns TRUE if the font having the font number fontNum is
  4345. available in the given size in a resource file, or FALSE if the font
  4346. has to be scaled to that size.
  4347. \ SetFontLock
  4348. 3
  4349. PROCEDURE SetFontLock (lockFlag: BOOLEAN);
  4350.  
  4351.     SetFontLock applies to the font in which text was most recently
  4352. drawn; it makes the font unpurgeable if lockFlag is TRUE or purgeable if
  4353. lockFlag is FALSE. Since fonts are normally purgeable, this procedure
  4354. is useful for making a font temporarily unpurgeable.
  4355. \ SwapFont
  4356. 3
  4357. FUNCTION SwapFont (inRec: FMInput) : FMOutPtr;
  4358.  
  4359.     SwapFont returns a pointer to an FMOutput record containing the
  4360. size, style, and other information about an adapted version of the font
  4361. requested in the given FMInput record. (FMInput and FMOutput records
  4362. are explained in the following section.)  SwapFont is called by
  4363. QuickDraw every time a QuickDraw routine that does anything with text
  4364. is used. If you want to call SwapFont yourself, you must build an
  4365. FMInput record and then use the returned pointer to access the
  4366. resulting FMOutput record.
  4367. \ FontMetrics
  4368. 3
  4369. PROCEDURE FontMetrics (VAR theMetrics: FMetricRec);
  4370.  
  4371.     FontMetrics is similar to the QuickDraw procedure GetFontInfo except
  4372. that it returns fixed-point values for greater accuracy in
  4373. high-resolution printing.
  4374.  
  4375. The FMetricRec data structure is defined as follows:
  4376.  
  4377. TYPE FMetricRec = RECORD
  4378.          ascent:    Fixed;  {ascent}
  4379.          descent:   Fixed;  {descent}
  4380.          leading:   Fixed;  {leading}
  4381.          widMax:    Fixed;  {maximum character width}
  4382.          wTabHandle:    Handle; {handle to global width table}
  4383.        END;
  4384.  
  4385.     Ascent, descent, leading, and widMax are identical in function to
  4386. their counterparts in GetFontInfo. WTabHandle is a handle to the
  4387. global width table (described below).
  4388.  
  4389. \ SetFractEnable
  4390. 3
  4391. PROCEDURE SetFractEnable (fractEnable: BOOLEAN)   [Not in ROM]
  4392.  
  4393.     SetFractEnable lets you enable or disable fractional character
  4394. widths. If fractEnable is TRUE, fractional character widths are enabled;
  4395. if it’s FALSE, the Font Manager uses integer widths. To ensure
  4396. compatibility with existing applications, fractional character widths
  4397. are disabled by default.
  4398. ___________________________________________________________________
  4399.  
  4400. Assembly-language note:  From assembly language, you can change the
  4401. value of the global variable FractEnable.
  4402. ___________________________________________________________________
  4403. \ SetFScaleDisable
  4404. 3
  4405. PROCEDURE SetFScaleDisable (fontScaleDisable: BOOLEAN);
  4406.  
  4407.     SetFScaleDisable lets you disable or enable font scaling.
  4408. If fontScaleDisable is TRUE, font scaling is disabled and
  4409. the Font Manager returns an unscaled font with more space around
  4410. the characters; if it’s FALSE, the Font Manager scales fonts.
  4411. To ensure compatibility with existing applications, the Font Manager
  4412. defaults to scaling fonts.
  4413.  
  4414.     ______________________________________________________________
  4415.     Assembly-language note:  All programmers should use the
  4416.     SetFScaleDisable procedure to disable and enable font scaling.
  4417.     In particular, setting the global variable FScaleDisable is
  4418.     insufficient.
  4419.     ______________________________________________________________
  4420. \ GetNextEvent
  4421. 4
  4422. FUNCTION GetNextEvent (eventMask: INTEGER; VAR theEvent: EventRecord)
  4423.                         : BOOLEAN;
  4424.  
  4425.     GetNextEvent returns the next available event of a specified type or
  4426. types and, if the event is in the event queue, removes it from the
  4427. queue. The event is returned as the value of the parameter theEvent.
  4428. The eventMask parameter specifies which event types are of interest.
  4429. GetNextEvent returns the next available event of any type designated by
  4430. the mask, subject to the priority rules discussed above under "Priority
  4431. of Events". If no event of any of the designated types is available,
  4432. GetNextEvent returns a null event.
  4433.  
  4434. (note)
  4435.     Events in the queue that aren't designated in the mask 
  4436.     are kept in the queue; if you want to remove them, you
  4437.     can do so by calling the Operating System Event Manager
  4438.     procedure FlushEvents.
  4439.  
  4440.     Before reporting an event to your application, GetNextEvent first
  4441. calls the Desk Manager function System Event to see whether the system
  4442. wants to intercept and respond to the event. If so, or if the event
  4443. being reported is a null event, GetNextEvent returns a function result
  4444. of FALSE; a function result of TRUE means that your application should
  4445. handle the event itself. The Desk Manager intercepts the following
  4446. events:
  4447.  
  4448.     - activate and update events directed to a desk accessory
  4449.  
  4450.     - keyboard events if the currently active window belongs to a desk
  4451.       accessory
  4452.  
  4453. (note)
  4454.     In each case, the event is intercepted by the Desk
  4455.     Manager only if the desk accessory can handle that type
  4456.     of event; however, as a rule all desk accessories should
  4457.     be set up to handle activate, update, and keyboard
  4458.     events.
  4459.  
  4460.     The Desk Manager also intercepts disk-inserted events:  It attempts
  4461. to mount the volume on the disk by calling the File Manager function
  4462. MountVol. GetNextEvent will always return TRUE in this case, though,
  4463. so that your application can take any further appropriate action after
  4464. examining the result code returned by MountVol in the event message.
  4465. (See the Desk Manager and File Manager manuals for further details.)
  4466. GetNextEvent returns TRUE for all other non-null events (including all
  4467. mouse-down events, regardless of which window is active), leaving them
  4468. for your application to handle.
  4469.  
  4470.     GetNextEvent also makes the following processing happen, invisible
  4471. to your program:
  4472.  
  4473.    -If the "alarm" is set and the current time is the alarm time, the
  4474.     alarm goes off (a beep followed by blinking the title of the Apple
  4475.     menu). The user can set the alarm with the Alarm Clock desk
  4476.     accessory.
  4477.  
  4478.    -If the user holds down the Command and Shift keys while pressing a
  4479.     numeric key that has a special effect, that effect occurs. The
  4480.     standard such keys are 1 and 2 for ejecting the disk in the
  4481.     internal or external drive, and 3 and 4 for writing a snapshot of
  4482.     the screen to a MacPaint document or to the printer.
  4483.  
  4484.  (note)
  4485.     Advanced programmers can implement their own code to be
  4486.     executed in response to Command-Shift-number combinations
  4487.     (except for Command-Shift-l and 2, which can't be 
  4488.     changed). The code corresponding to a particular number
  4489.     must be a routine having no parameters, stored in a
  4490.     resource whose type is 'FKEY' and whose ID is the number.
  4491.     The system resource file contains code for the numbers 3
  4492.     and 4.
  4493. \ EventAvail
  4494. 4
  4495. FUNCTION EventAvail (eventMask: INTEGER; VAR theEvent: EventRecord) :
  4496.     BOOLEAN;
  4497.  
  4498.     EventAvail works exactly the same as GetNextEvent except that if the
  4499. event is in the event queue, it's left there.
  4500.  
  4501. (note)
  4502.     An event returned by EventAvail will not be accessible
  4503.     later if in the meantime the queue becomes full and the
  4504.     event is discarded from it; since the events discarded
  4505.     are always the oldest ones in the queue, however, this
  4506.     will happen only in an unusually busy environment.
  4507. \ GetMouse
  4508. 4
  4509. PROCEDURE GetMouse (VAR mouseLoc: Point);
  4510.  
  4511.     GetMouse returns the current mouse location in the mouseLoc
  4512. parameter. The location is given in the local coordinate system of the
  4513. current grafPort (which might be, for example, the currently active
  4514. window). Notice that this differs from the mouse location stored in the
  4515. where field of an event record; that location is always in global
  4516. coordinates.
  4517. \ Button
  4518. 4
  4519. FUNCTION Button : BOOLEAN;
  4520.  
  4521.     The Button function returns TRUE if the mouse button is currently
  4522. down, and FALSE if it isn't.
  4523. \ Stilldown
  4524. 4
  4525. FUNCTION StillDown : BOOLEAN;
  4526.  
  4527.     Usually called after a mouse-down event, StillDown tests whether the
  4528. mouse button is still down. It returns TRUE if the button is currently
  4529. down and there are no more mouse events pending in the event queue.
  4530. This is a true test of whether the button is still down from the
  4531. original press--unlike Button (above), which returns TRUE whenever the
  4532. button is currently down, even it ift has been released and pressed
  4533. again since the original mouse-down event.
  4534. \ WaitMouseUp
  4535. 4
  4536. FUNCTION WaitMouseUp ) BOOLEAN;
  4537.  
  4538.     WaitMouseUp works exactly the same as StillDown (above), excent that
  4539. if the button is not still down from the original press, WaitMouseUp
  4540. removes the preceding mouse-up event before returning FALSE. If, for
  4541. instance, your application attaches some special significance both to
  4542. mouse double-clicks and to mouse-up events, this function would allow
  4543. your application to recognize a double-click without being confused by
  4544. the intervening mouse-up.
  4545. \ GetKeys
  4546. 4
  4547. PROCEDUREGetKeys (VAR theKeys: KeyMap);
  4548.  
  4549.     GetKeys reads the current state of the keyboard (and keypad, if any)
  4550. and returns it in the form of a keyMap:
  4551.  
  4552.     TYPE KeyMap = PACKED ARRAY [Ø..127] OF BOOLEAN;
  4553.  
  4554.     Each key on the keyboard or keypad corresponds to an element in the
  4555. keyMap. The index into the keyMap for a particular key is the same as
  4556. the key code for that key. (The key codes are shown in Figure 3
  4557. above.)  The keyMap element is TRUE if the corresponding key is down
  4558. and FALSE if it isn't. The maximum number of keys that can be down 
  4559. simultaneously is two character keys plus any combination of the four
  4560. modifier keys.
  4561. \ TickCount
  4562. 4
  4563. FUNCTION TickCount : LONGINT;
  4564.  
  4565.     TickCount returns the current number of ticks (sixtieths of a
  4566. second) since the system was last started up.
  4567. \ GetDblTime
  4568. 4
  4569. FUNCTION GetDblTime : LONGINT; [No trap macro]
  4570.  
  4571.     GetDblTime returns the suggested maximum difference (in ticks) that
  4572. should exist between the times of a mouse-up event and a mouse-down
  4573. event for those two mouse clicks to be considered a double-click. The
  4574. user can adjust this value by means of the Control Panel desk
  4575. accessory.
  4576. \ GetCaretTime
  4577. 4
  4578. FUNCTION GetCaretTime : LONGINT; [No trap macro]
  4579.  
  4580.     GetCareTime returns the time (in ticks) between blinks of the
  4581. "caret" (usually a vertical bar) marking an insertion point in editable
  4582. text. If you aren't using TextEdit, you'll need to cause the caret to
  4583. blink yourself; on every pass through your program's main event loop,
  4584. you should check this value against the elapsed time since the last
  4585. blink of the caret. The user can adjust this value by means of the
  4586. Control Panel desk accessory.
  4587. \ InitWindows
  4588. 5
  4589. PROCEDURE InitWindows;
  4590.  
  4591.     InitWindows initializes the Window Manager. It creates the Window
  4592. Manager port; you can get a pointer to this port with the GetWMgrPort
  4593. procedure. InitWindows draws the desktop and the (empty menu bar.
  4594. Call this procedure once berore all other Window Manager routines.
  4595.  
  4596. (note)
  4597.     InitWindows creates the Window Manager port as a
  4598.     nonrelocatable block in the application heap. For
  4599.     information on how this may affect your application's use
  4600.     of memory, see the Memory Manager manual. ***(A section
  4601.     on how to survive with limited memory will be added to
  4602.     that manual.) ***
  4603. \ GetWMgrPort
  4604. 5
  4605. PROCEDURE GetWMgrPort (VAR wPort:  GrafPtr);
  4606.  
  4607.     GetWMgrPort returns in wPort a pointer to the Window Manager port.
  4608. \ NewWindow
  4609. 5
  4610. FUNCTION NewWindow (wStorage: Ptr; boundsRect: Rect; title: Str255;
  4611.                     visible: BOOLEAN; procID: Integer;behind: WindowPtr;
  4612.                     goAway Flag: BOOLEAN; refCon: LongInt) : WindowPtr;
  4613.  
  4614.     NewWindow creates a window as specified by its parameters, adds it
  4615. to the window list, and returns a windowPtr to the new window. It
  4616. allocates space for the structure and content regions of the window and
  4617. asks the window definition function to calculate those regions.
  4618.  
  4619.     WStorage is a pointer to where to store the window record. For
  4620. example, if you've declared the variable wRecord of type WindowRecord,
  4621. you can pass @wRecord as the first parameter to NewWindow. If you pass
  4622. NIL for wStorage, the window record will be allocated on the heap; in
  4623. that case, though, the record will be nonrelocatable, and so you risk
  4624. ending up with a fragmented heap. You should therefore not pass NIL
  4625. for wStorage unless your program has an unusually large amount of
  4626. memory available or has been set up to dispose of windows dynamically.
  4627. Even then, you should avoid passing NIL for wStorage if there's no 
  4628. limit to the number of windows that your application can open. ***
  4629. (Some of this may be moved to the Memory Manager manual when that
  4630. manual is updated to have a section on how to survive with limited
  4631. memory.) ***
  4632.  
  4633.     BoundsRect, a rectangle given in global coordinates, determines the
  4634. window's size and location. It becomes the portRect of the window's
  4635. grafPort; note, however, that the portRect is in local coordinates.
  4636. New Window makes the QuickDraw call SetOrigin(Ø,Ø), so that the top left
  4637. corner of the portRect will be (Ø,Ø).
  4638.  
  4639. (note)
  4640.     The bitMap, pen pattern, and other characteristics of the
  4641.     window's grafPort are the same as the default values set
  4642.     by the OpenPort procedure in QuickDraw, except for the
  4643.     character font, which is set to the application font
  4644.     rather than the system font. Note, however, that the
  4645.     SetOrigin(Ø,Ø) call changes the coordinates of the
  4646.     grafPort's portBits.bounds and visRgn as well as its 
  4647.     PortRect.
  4648.  
  4649.     Title is the window's title. If the title of a document window is 
  4650. longer than will fit in the title bar, only as much of the beginning of
  4651. the title as will fit is displayed.
  4652.  
  4653.     If the visible parameter is TRUE, NewWindow draws the window. First
  4654. it calls the window definition function to draw the window frame; if
  4655. goAwayFlag is also TRUE and the window is frontmost (as specified by
  4656. the behind parameter, below), it draws a go-away region in the frame.
  4657. Then it generates an update event for the entire window contents.
  4658.  
  4659.     ProcID is the window definition ID, which leads to the window
  4660. definition function for this type of window. The window definition IDs
  4661. for the predefined types of windows are listed above under "Windows and 
  4662. Resources". Window definition IDs for windows of your own design are 
  4663. discussed later under "Defining Your Own Windows".
  4664.  
  4665.     The behind parameter determines the window's plane. The new window
  4666. is inserted in back of the window pointed to by this parameter. To put
  4667. the new window behind all other windows, use behind=NIL. To place it
  4668. in front of all other windows, use behind=POINTER(-1); in this case,
  4669. NewWindow will unhighlight the previously active window, highlight the
  4670. window being created, and generate appropriate activate events.
  4671.  
  4672.     RefCon is the window's reference value, set and used only by your 
  4673. application.
  4674.  
  4675.     NewWindow also sets the window class in the window record to
  4676. indicate that the window was created directly by the application.
  4677. \ GetNewWindow
  4678. 5
  4679. FUNCTION GetNewWindow (ID: INTEGER; wStorage: Ptr; behind:
  4680.                         WindowPtr) : WindowPtr;
  4681.  
  4682.     Like NewWindow (above), GetNewWindow creates a window as specified
  4683. by its parameters, adds it to the window list, and returns a windowPtr
  4684. to the new window. The only difference between the two functions is
  4685. that instead of having the parameters boundsRect, title, visible,
  4686. procId, goAwayFlag, and refCon, GetNewWindow has a single windowID
  4687. parameter, where windowID is the resource ID of a window template that
  4688. supplies the same information as those parameters. The wStorage and
  4689. behind parameters of GetNewWindow have the same meaning as in NewWindow.
  4690. \ CloseWindow
  4691. 5
  4692. PROCEDURE CloseWindow (theWindow: WindowPtr);
  4693.  
  4694.     CloseWindow removes the given window from the screen and deletes it
  4695. from the window list. It releases the memory occupied by all data
  4696. structures associated with the window, but not the memory taken up by
  4697. the window record itself. Call this procedure when you're done with a 
  4698. window if you supplied NewWindow or GetNewWindow a pointer to the
  4699. window storage (in the wStorage parameter) when you created the window.
  4700.  
  4701.     Any update events for the window are discarded. If the window was
  4702. the frontmost window and there was another window behind it, the latter
  4703. window is highlighted and an appropriate activate event is generated.
  4704. \ DisposeWindow
  4705. 5
  4706. PROCEDURE DisposeWindow (theWindow: WindowPtr);
  4707.  
  4708.     DisposeWindow calls CloseWindow (above) and then releases the memory
  4709. occupied by the window record. Call this procedure when you're done 
  4710. with a window if you let the window record be allocated on the heap
  4711. when you created the window (by passing NIL as the wStorage parameter
  4712. to NewWindow or GetNewWindow).
  4713. \ SetWTitle
  4714. 5
  4715. PROCEDURE SetWTitle (theWindow: WindowPtr; title: Str255);
  4716.  
  4717.     SetWTitle sets the Window's title to the given string, performing
  4718. any necessary redrawing of the window frame.
  4719. \ GetWTitle
  4720. 5
  4721. PROCEDURE GetWTitle (theWindow: WindowPtr; VAR title: Str255);
  4722.  
  4723.     GetWTitle returns theWindow's title as the value of the title
  4724. parameter.
  4725. \ SelectWindow
  4726. 5
  4727. PROCEDURE SelectWindow (theWindow: WindowPtr);
  4728.  
  4729.     SelectWindow makes theWindow the active window as follows:  it
  4730. unhighlights the previously active window, brings theWindow in front of
  4731. all other windows, highlights theWindow, and generates the appropriate
  4732. activate events. Call this procedure if there's a mouse-down event in 
  4733. the content region of an inactive window.
  4734. \ HideWindow
  4735. PROCEDURE HideWindow (theWindow: WindowPtr);
  4736.  
  4737.     HideWindow makes theWindow invisible. If theWindow is the frontmost
  4738. window and there's a window behind it, HideWindow also unhighlights 
  4739. theWindow, brings the window behind it to the front, highlights that
  4740. window, and generates appropriate activate events (se Figure 6). If
  4741. theWindow is already invisible, HideWindow has no effect.
  4742. \ ShowWindow
  4743. 5
  4744. PROCEDURE ShowWindow (theWindow: WindowPtr);
  4745.  
  4746.     ShowWindow makes theWindow visible. It does not change the front-to-
  4747. back ordering of the windows. Remember that if you previously hid the
  4748. frontmost window with HideWindow, HideWindow will have brought the
  4749. window behind it to the front; so if you then do a ShowWindow of the
  4750. window you hid, it will no longer be frontmost (see Figure 6 above).
  4751. If the Window is already visible, ShowWindow has no effect.
  4752.  
  4753. (note)
  4754.     Although it's inadvisable, you can create a situation 
  4755.     where the frontmost window is invisible. If you do a
  4756.     ShowWindow of such a window, it will highlight the window
  4757.     if it's not already highlighted and will generate an 
  4758.     activate event to force this window from inactive to
  4759.     active.
  4760. \ ShowHide
  4761. 5
  4762. PROCEDURE ShowHide (theWindow: WindowPtr; showFlag: (BOOLEAN);
  4763.  
  4764.     If showFlag is FALSE, ShowHide makes theWindow invisible if it's not
  4765. already invisible and has no effect if it is already invisible. If
  4766. showFlag is TRUE, ShowHide makes the Window visible if it's not already
  4767. visible and has no effect if it is already visible. Unlike HideWindow
  4768. and ShowWindow, ShowHide never changes the highlighting or front-to-
  4769. back ordering of windows or generates activates events.
  4770.  
  4771. (warning)
  4772.     Use this procedure carefully, and only in special
  4773.     circumstances where you need more control than allowed by
  4774.     HideWindow and ShowWindow.
  4775. \ HiliteWindow
  4776. 5
  4777. PROCEDURE HiliteWindow (theWindow: WindowPtr; fHilite: BOOLEAN);
  4778.  
  4779.     If fHilite isTRUE, this procedure highlights theWindow if it's not
  4780. already highlighted and has no effect if it is highlighted. If fHilite
  4781. is FALSE, HiliteWindow unhighlights theWindow if it is highlighted and
  4782. has no effect if it's not highlighted. The exact way a window is 
  4783. highlighted depdnds on its window definition function.
  4784.  
  4785.     Normally you won't have to call this procedure, since you should
  4786. call SelectWindow to make a window active, and SelectWindow takes care
  4787. of the necessary highlighting changes. Highlighting a window that isn't 
  4788. the active window is contrary to the Macintosh User Interface
  4789. Guidelines.
  4790. \ BringToFront
  4791. 5
  4792. PROCEDURE BringToFront (theWindow: WindowPtr);
  4793.  
  4794.     BringToFront brings theWindow to the front of all other windows and
  4795. redraws the window as necessary. Normally you won't have to call this 
  4796. procedure, since you should call SelectWindow to make a window active,
  4797. and SelectWindow takes care of bringing the window to the front. If
  4798. you do call BringToFront, however, remember to call HiliteWindow to
  4799. make the necessary highlighting changes.
  4800. \ SendBehind
  4801. 5
  4802. PROCEDURE SendBehind (theWindow: WindowPtr; behindWindow: WindowPtr);
  4803.  
  4804.     SendBehind sends theWindow behind behindWindow, redrawing any
  4805. exposed windows. If behindWindow is NIL, it sends theWindow behind all
  4806. other windows. If theWindow is the active window, it unhighlights the
  4807. Window, highlights the new active window, and generates the appropriate
  4808. activate events.
  4809.  
  4810. (warning)
  4811.     Do not use SendBehind to deactivate a previously active
  4812.     window. Calling SelectWindow to make a window active
  4813.     takes care of deactivating the previously active window.
  4814.  
  4815. (note)
  4816.     If you're moving theWindow closer to the front (that is,
  4817.     if it's initially even farther behind behind(Window), you
  4818.     must make the following calls after calling SendBehind:
  4819.  
  4820.         wPeek := POINTER(theWindow);
  4821.         PaintOne(wPeek, wPeek^.strucRgn);
  4822.         CalcVis(wPeek)
  4823.  
  4824.     PaintOne and CalcVis are described below under "Low'Level
  4825.     Routines".
  4826. \ FrontWindow
  4827. 5
  4828. FUNCTION FrontWindow : WindowPtr;
  4829.  
  4830.     FrontWindow returns a pointer to the first visible window in the
  4831. window list (that is, the active window). If there are no visible
  4832. windows, it returns NIL.
  4833. \ DrawGrowIcon
  4834. 5
  4835. PROCEDURE DrawGrowIcon (theWindow: WindowPtr).
  4836.  
  4837.     Call DrawGrowIcon in responce to an update or activate event
  4838. involving a window that contains a size box in its content region. If
  4839. theWindow is active (highlighted), DrawGrowIcon draws the size box;
  4840. otherwise, it draws whatever is appropriate to show that thewindow
  4841. temporily cannot be sized. The exact appearance and location of what's
  4842. drawn depend on the window definition function. For an active document
  4843. window, DrawGrowIcon draws the size box icon in the bottom right corner
  4844. of the portRect of the window's grafPort, along with the lines
  4845. delimiting the size box and scroll bar areas (15 pixels in from the
  4846. right edge and bottom of the portRect). It doesn't erase the scroll
  4847. bar areas, so if the window doesn't contain scroll bars you should 
  4848. erase those areas yourself after the window's size changes. For an 
  4849. inactive document window, DrawGrowIcon draws only the delimiting lines
  4850. (again, without erasing anything).
  4851. \ FindWindow
  4852. 5
  4853. FUNCTION FindWindow (thePt: Point; VAR whichWindow: WindowPtr) :
  4854.     INTEGER;
  4855.  
  4856.     When a mouse-down event occurs, the application should call
  4857. FindWindow with thePt equal to the point where the mouse button was
  4858. pressed (in global coordinates, as stored in the where field of the
  4859. event record). FindWindow tells which part of which window, if any, the
  4860. mouse button was pressed in. If it was pressed in a window, the
  4861. whichWindow parameter is set to the window pointer; otherwise, it's set
  4862. to NIL. The integer returned by FindWindow is one of the following
  4863. predefined constants:
  4864.  
  4865. CONST inDesk      = Ø;  {none of the following}
  4866.       InMenuBar   = 1;  {in menu bar}
  4867.       inSysWindow = 2;  {in system window}
  4868.       inContent   = 3;  {in content region (except grow, if active)}
  4869.       inDrag      = 4;  {in drag region}
  4870.       inGrow      = 5;  {in grow region (active window only)}
  4871.       inGoAway    = 6;  {in go-away region (active window only)}
  4872.       inZoomin    = 7;
  4873.       inZoomOut   = 8;
  4874.  
  4875.     InDesk usually means that the mouse button was pressed on the
  4876. desktop, outside the menu bar or any windows; however, it may also mean
  4877. that the mouse button was pressed inside a window frame but not in the
  4878. drag region or go-away region of the window. Usually one of the last
  4879. four values is returned for windows created by the application.
  4880.  
  4881.     If the window is a documentProc type of window that doesn't contain
  4882. a size box, the application should treat  inGrow the same as inContent;
  4883. if it's a noGrowDocProc type of window, FindWindow will never return 
  4884. inGrow for that window. If the window is a documentProc, noGrowDocProc,
  4885. or rDocProc type of window with no close box, FindWindow will never
  4886. return inGoAway for that window.
  4887. \ TrackGoAway
  4888. 5
  4889. FUNCTION TrackGoAway (theWindow: WindowPtr; thePt: Point) : BOOLEAN;
  4890.  
  4891.     When there's a mouse-down event in the go-away region of theWindow,
  4892. the application should call TrackGoAway with thePt equal to the point
  4893. where the mouse button was pressed (in global coordinates, as stored in
  4894. the where field of the event record). TrackGoAway keeps control until
  4895. the mouse button is released, highlighting the go-away region as long as
  4896. the mouse position remains inside it, and unhighlighting it when the
  4897. mouse moves outside it. The exact way a window's go-away region is 
  4898. highlighted depends on its window definition function; the highlighting
  4899. of a document window's close box is illustrated in Figure 7. When the 
  4900. mouse  button is released, TrackGoAway unhighlights the go-away region
  4901. and returns TRUE if the mouse is inside the go-away region or FALSE if
  4902. it's outside the region (in which case the application should do
  4903. nothing).
  4904. \ MoveWindow
  4905. 5
  4906. PROCEDURE MoveWindow (theWindow: WindowPtr; hGlobal,vGlobal: INTEGER;
  4907.     front: BOOLEAN);
  4908.  
  4909.     MoveWindow moves theWindow to another part of the screen, without
  4910. affecting its size or plane.  The top left corner of the portRect of
  4911. the window's grafPort is moved to the screen point indicated by the 
  4912. global coordinates hGlobal and vGlobal. The local coordinates of the
  4913. top left corner remain the same; MoveWindow saves those coordinates
  4914. before moving the window and calls the QuickDraw procedure SetOrigin to
  4915. restore them before returning. If the front parameter is TRUE and
  4916. theWindow isn't the active window, MoveWindow makes it the active 
  4917. window by calling SelectWindow(theWindow).
  4918. \ DragWindow
  4919. 5
  4920. PROCEDURE DragWindow (theWindow: WindowPtr; startPt: Point; boundsRect:
  4921.     Rect);
  4922.  
  4923.     When there's a mouse-down event in the drag region of theWinow, the 
  4924. application should call DragWindow with StartPt equal to the point
  4925. where the mouse button was pressed (in global coordinates, as stored in
  4926. the where field of the event record). DragWindow pulls a gray outline
  4927. of theWindow around, following the movements of the mouse until the
  4928. button is released. When the mouse button is released, DragWindow
  4929. calls MoveWindow to move theWindow to the location to which it was
  4930. dragged. If theWindow is not the active window and the Command key was
  4931. not being held down, DragWindow makes it the active window (by passing
  4932. TRUE for the front parameter when calling MoveWindow).
  4933.  
  4934.     BoundsRect is also given in global coordinates. If the mouse button
  4935. is released when the mouse position is outside the limits of boundsRect,
  4936. DragWindow returns without moving theWindow or making it the active
  4937. window. For a document window, boundsRect typically will be four
  4938. pixels in from the menu bar and from the other edges of the screen, to
  4939. ensure that there won't be less than a four-pixel-square area of the 
  4940. title bar visible on the screen.
  4941. \ GrowWindow
  4942. 5
  4943. FUNCTION GrowWindow (theWindow: WindowPtr; startPt: Point; sizeRect:
  4944.     Rect) : LongInt;
  4945.  
  4946.     When there's a mouse-down event in the grow region of theWindow, the 
  4947. application should call GrowWindow with startPt equal to the point
  4948. where the mouse button was pressed (in global ccoordinates, as stored in
  4949. the where field of the event record). GrowWindow pulls a GROW IMAGE of
  4950. the window around, following the movements of the mouse until the
  4951. button is released. The grow image for a document window is a gray
  4952. outline of the entire window and also the lines delimiting the title
  4953. bar, size box, and scroll bar areas; Figure 8 illustrates this for a
  4954. document window containing a size box and scroll bars, but the grow
  4955. image would be the same even if the window contained no size box, one
  4956. scroll bar, or no scroll bars. In general, the grow image is defined
  4957. in the window definition function and is whatever is appropriate to
  4958. show that the window's size will change. 
  4959.  
  4960.     The application should subsequently call SizeWindow (see below) to
  4961. change the portRect of the window's grafPort to the new one outlined by 
  4962. the grow image. The sizeRect parameter specifies limits, in pixels, on
  4963. the vertical and horizontal measurements of what will be the new
  4964. portRect. SizeRect.top is the minimum vertical measurement,
  4965. sizeRect.left is the minimum horizontal measurement, sizeRect.bottom is
  4966. the maximum vertical measurement, and sizeRect.right is the maximum
  4967. horizontal measurement.
  4968.  
  4969.     GrowWindow returns the actual size for the new portRect as outlined
  4970. by the grow image when the mouse button is released. The high-order
  4971. word of the LongInt is the vertical measurement in pixels and the
  4972. low-order word is the horizontal measurement. A return value of Ø
  4973. indicates that the size is the same as that of the current portRect.
  4974.  
  4975. (note)
  4976.     The Toolbox Utility function HiWord takes a long integer
  4977.     as a parameter and returns an integer equal to its high-
  4978.     order word; the function LoWord returns the low-order
  4979.     word.
  4980. \ SizeWindow
  4981. 5
  4982. PROCEDURE SizeWindow (theWindow: WindowPtr; w,h: INTEGER; fUpdate:
  4983.     BOOLEAN);
  4984.  
  4985.     SizeWindow enlarges or shrinks the portRect of the Window's grafPort
  4986. to the width and height specified by w and h, or does nothing if w and h
  4987. are Ø. The window's position on the screen does not change. The new 
  4988. window frame is drawn; if the width of a document window changes, the
  4989. title is again centered in the title bar, or is truncated at its end if
  4990. it no longer fits. If fUpdate is TRUE, SizeWindow accumulates any
  4991. newly created area of the content region into the update region (see
  4992. figure 9);  normally this is what you'll want. If you pass FALSE for 
  4993. fUpdate, you're responsible for the update region maintenance yourself.
  4994. For more information, see InvalRect and ValidRect below.
  4995.  
  4996. (note)
  4997.     You should change the window's size only when the user 
  4998.     has done something specific to make it change.
  4999. \ InvalRect
  5000. 5
  5001. PROCEDURE InvalRect (badRect: Rect);
  5002.  
  5003.     InvalRect accumulates the given rectangle into the update region of
  5004. the window whose grafPort is the current port. This tells the Window
  5005. Manager that the rectangle has changed and must be updated. The
  5006. rectangle lies within the window's content region and is given in the 
  5007. local coordinates.
  5008.  
  5009.     For example, this procedure is useful when you're calling SizeWindow 
  5010. (described above) for a document window that contains a size box or
  5011. scroll bars. Suppose yuou're going to call SizeWindow with 
  5012. fUpdate=TRUE. If the window is enlarged as shown in Figure 8 above,
  5013. you'll want not only the newly created part of the content region to be 
  5014. updated, but also the two rectangular areas containing the (former)
  5015. size box and scroll bars; before calling SizeWindow, you can call
  5016. InvalRect twice to accumulate those areas into the update region. In
  5017. case the window is made smaller, you'll want the new size box and 
  5018. scroll bar areas to be updated, and so can similarly call InvalRect for
  5019. those areas after calling SizeWindow. See Figure 1Ø for an
  5020. iillustration of this type of update region maintenance.
  5021.  
  5022.     As another example, suppose your application scrolls up text in a
  5023. document window and wants to show new text added at the bottom of the
  5024. window. You can cause the added text to be redrawn by accumulating
  5025. that area into the update region with InvalRect.
  5026. \ InvalRgn
  5027. 5
  5028. PROCEDURE InvalRgn (badRgn: RgnHandle);
  5029.  
  5030.     InvalRgn is the same as InvalRect (above) but for a region that has
  5031. changed rather than a rectangle.
  5032. \ ValidRect
  5033. 5
  5034. PROCEDURE ValidRect (goodRect: Rect);
  5035.  
  5036.     ValidRect removes goodRect from the update region of the window
  5037. whose grafPort is the current port. This tells the Window Manager that
  5038. the application has already drawn the rectangle and to cancel any
  5039. updates accumulated for that area. The rectangle lies within the
  5040. window's content region and is given in local coordinates. Using
  5041. ValidRect results in better performance and less redundant redrawing in
  5042. the window.
  5043.  
  5044.     For example, suppose you've called SizeWindow (described above) with 
  5045. fUpdate=TRUE for a document window that contains a size box or scroll
  5046. bars. Depending on the dimensions of the newly sized window, the new
  5047. size box and scroll bar areas may or may not have been accumulated into
  5048. the window's update region. After calling SizeWindow, you can redraw
  5049. the size box or scroll bars immediately and then call ValidRect for the
  5050. areas they occupy in case they were in fact accumulated into the update
  5051. region; this will avoid redundant drawing.
  5052. \ ValidRgn
  5053. 5
  5054. PROCEDURE ValidRgn (goodRgn: RgnHandle);
  5055.  
  5056.     ValidRgn is the same as ValidRect (above) but for a region that has
  5057. been drawn rather than a rectangle.
  5058. \ BeginUpdate
  5059. 5
  5060. PROCEDURE BeginUpdate (theWindow: WindowPtr);
  5061.  
  5062.     Call BeginUpdate when an update event occurs for theWindow.
  5063. BeginUpdate replaces the visRgn of the window's grafPort with the 
  5064. intersection of the visRgn and the update region and then sets the
  5065. window's update region to the empty region. You would then usually
  5066. draw the entire content region, though it suffices to draw only the
  5067. visRgn; in either case, only the parts of the window that require
  5068. updating will actually be drwn on the screen. Every call to
  5069. BeginUpdate must be balanced by a call to EndUpdate. (See below, and
  5070. see "How a Window is Drawn".)
  5071. \ EndUpdate
  5072. 5
  5073. PROCEDURE EndUpdate (theWindow: WindowPtr);
  5074.  
  5075.     Call EndUpdate to restore the normal visRgn of theWindow's grafPort, 
  5076. which was changed by BeginUpdate as described above.
  5077. \ SetWRefCon
  5078. 5
  5079. PROCEDURESetWRefCon (theWindow: WindowPtr; data: LongInt);
  5080.  
  5081.     SetWRefCon sets theWindow's reference value to the given data.
  5082. \ GetWRefCon
  5083. 5
  5084. FUNCTION GetWRefCon (theWindow: WindowPtr) : LongInt;
  5085.  
  5086.     GetWRefCon returns theWindow's current reference value. 
  5087. \ SetWindowPic
  5088. 5
  5089. PROCEDURE SetWindowPic (theWindow: WindowPtr; pic: PicHandle);
  5090.  
  5091.     SetWindowPic stores the given picture handle in the window record
  5092. for theWindow, so that when theWindow's contents are to be drawn, the 
  5093. Window Manager will draw this picture rather than generate an update
  5094. event.
  5095. \ GetWindowPic
  5096. 5
  5097. FUNCTION GetWindowPic (theWindow: WindowPtr) : PicHandle;
  5098.  
  5099.     GetWindowPic returns the handle to the picture that draws
  5100. theWindow's contents, previously stored with SetWindowPic (above).
  5101. \ PinRect
  5102. 5
  5103. FUNCTION PinRect (theRect: Rect; thePt: Point) : LongInt;
  5104.  
  5105.     PinRect "pins" thePt inside theRect: The high-order word of the
  5106. function result is the vertical coordinate of thePt or, if thePt lies
  5107. above or below theRect, the vertical coordinate of the top or bottom of
  5108. theRect, respectively. The low-order word of the function result is
  5109. the horizontal coordinate of thePt or, if thePt lies to the left or
  5110. right of theRect, the horizontal coordinate of the left or right edge
  5111. of theRect.
  5112. \ DragGrayRgn
  5113. 5
  5114. FUNCTION DragGrayRgn (theRgn: RgnHandle; startPt: Point;
  5115.     limitRect,slopRect: Rect; axis: INTEGER; actionProc:
  5116.     ProcPtr : LongInt;
  5117.  
  5118.     Called when the mouse button is down inside theRgn, DragGrayRgn
  5119. pulls a gray outline of the region around, following the movements of
  5120. the mouse until the button is released. DragWindow calls this function
  5121. before actually moving the window, and the Control Manager routine
  5122. DragControl similarly calls it for controls. You can call it yourself
  5123. to pull around the outline of any region, and then use the information
  5124. it returns to determine where to move the region.
  5125.  
  5126.     The startPt parameter is assumed to be the point where the mouse
  5127. button was orignally pressed, in the local coordinates of the current
  5128. LimitRect and slopRect are also in the local coordinates of the current
  5129. grafPort. To explain these parameters, the concept of "offset point"
  5130. must be introduced: this is the point whose vertical and horizontal
  5131. offsets from the top left corner of the region's enclosing rectangle 
  5132. are the same as those of startPt. Initially the offset point is the
  5133. same as the mouse position, but they may differ, depending on where the
  5134. user moves the mouse. DragGrayRgn will never move the offset point
  5135. outside limitRect; this limits the travel of the region's outline (but
  5136. not the movements of the mouse). SlopRect, which should completely
  5137. enclose limitRect, allows the user some "slop" in moving the mouse.
  5138. DragGrayRgn's behavior while tracking the mouse depends on the position 
  5139. of the mouse with respect to these two rectangles
  5140.  
  5141.    - when the mouse is inside limitRect, the region's outline follows
  5142.      it normally. If the mouse button is released there, the region
  5143.      should be moved to the mouse position.
  5144.  
  5145.    - When the mouse is outside limitRect but inside slopRect,
  5146.      DragGrayRgn "pins" the offset point to the edge of limitRect. If
  5147.      the mouse button is released there, the region should be moved to
  5148.      this pinned location.
  5149.  
  5150.    - When the mouse is outside slopRect, the outline disappears from
  5151.      screen, but DragGrayRgn continues to follow the mouse; if it
  5152.      moves back into slopRect, the outline reappears. If the mouse
  5153.      button is released outside slopRect, the region should not be
  5154.      moved from its original position.
  5155.  
  5156.     Figure 11 illustrates what happens when the mouse is moved outside
  5157. limitRect but inside slopRect, for a rectangular region. The offset
  5158. point is pinned as the mouse position moves on.
  5159.  
  5160.     If the mouse button is released outside slopRect, DragGrayRgn
  5161. returns -32768 ($8ØØØ); otherwise, the high-order word of the value
  5162. returned contains the vertical coordinate of the ending mouse point
  5163. minus that of startPt and the low-order word contains the difference
  5164. between the horizontal coordinates.
  5165.  
  5166.     The axis parameter allows you to constrain the outline's motion to
  5167. only one axis. It has one of the following values:
  5168.  
  5169.     CONST noConstraint = Ø;     {no constraint}
  5170.           hAxis Only   = 1;     {horizontal axis only}
  5171.           vAxis Only   = 2;     {vertical axis only}
  5172.  
  5173.     If noaxis constraint is in effect, the outline will follow the
  5174. mouse's movements along the specified axis only, ignoring motion along
  5175. the other axis. With or without an axis constraint, the mouse must
  5176. still be inside the slop rectangle for the outline to appear at all.
  5177.  
  5178.     The actionProc parameter is a pointer to a procedure that defines
  5179. some action to be performed repeatedly for as long as the user holds
  5180. down the mouse button; the procedure should have no parameters. If
  5181. actionProc is NIL, DragGrayRgn simply retains control until the mouse
  5182. button is released, performing no action while the mouse button is
  5183. down.
  5184. \ CheckUpdate
  5185. 5
  5186. FUNCTION CheckUpdate (VAR the Event: EventRecord) : BOOLEAN;
  5187.  
  5188.     CheckUpdate is called by the Toolbox Event Manager. From the front
  5189. to the back in the window list, it looks for a visible window that needs
  5190. updating (that is, whose update region is not empty). If it finds one
  5191. whose window record contains a picture handle, it draws the picture
  5192. (doing all the necessary region manipulation) and looks for the next
  5193. visible window that needs updating. If it ever finds one whose window
  5194. record doesn't contain a picture handle, it stores an update event for 
  5195. that window in theEvent and returns TRUE. If it never finds such a
  5196. window, it returns FALSE.
  5197. \ ClipAbove
  5198. 5
  5199. PROCEDURE ClipAbove (window: WindowPeek);
  5200.  
  5201.     ClipAbove sets the clipRgn of the Window Manager port to be the
  5202. desktop (global variable grayRgn) intersected with the current clipRgn,
  5203. minus the structure regions of all the windows above the given window.
  5204. \ SaveOld
  5205. 5
  5206. PROCEDURE SaveOld (window: WindowPeek);
  5207.  
  5208.     SaveOld saves the given window's current structure region and
  5209. content region for the DrawNew operation (see below). It must be
  5210. balanced by a subsequent call to DrawNew.
  5211. \ DrawNew
  5212. 5
  5213. PROCEDURE DrawNew (window: WindowPeek; update: BOOLEAN);
  5214.  
  5215.     If the update parameter is TRUE, DrawNew updates the area.
  5216.  
  5217.     (oldStruct XOR newStruct) UNION oldContent XOR newContent)
  5218.  
  5219.     where oldStruct and oldContent are the structure and content regions
  5220. saved by the SaveOld procedures, and newStruct and newContent are the
  5221. current structure and content regions. It paints the area white and
  5222. adds it to the window's update region. If update is FALSE, it only
  5223. paints the area white.
  5224.  
  5225. (warning)
  5226.     SaveOld and DrawNew are not nestable.
  5227. \ PaintOne
  5228. 5
  5229. PROCEDURE PaintOne (window: WindowPeek; clobberedRgn: RgnHandle);
  5230.  
  5231.     PaintOne "paints" the given window, clipped to clobberedRgn and all
  5232. windows above it: it draws the window frame and, if some content is
  5233. exposed, paints the exposed area white and adds it to the window's 
  5234. update region. If the window parameter is NIL, the window is the
  5235. desktop and so is painted gray.
  5236. \ PaintBehind
  5237. 5
  5238. PROCEDURE PaintBehind (startWindow: WindowPeek; clobberedRgn:
  5239.     RgnHandle);
  5240.  
  5241.     PaintBehind calls PaintOne (above for startWindow and all the
  5242. windows behind startWindow, clipped to clobberedRgn.
  5243. \ CalcVis
  5244. 5
  5245. PROCEDURE CalcVis (window: WindowPeek);
  5246.  
  5247.     CalVis calculates the visRgn of the given window by starting with
  5248. its content region and subtracting the structure region of each window
  5249. in front of it.
  5250. \ CalcVisBehind
  5251. 5
  5252. PROCEDURE CalcVisBehind (startWindow: WindowPeek; clobberedRgn:
  5253.     RegHandle;
  5254.  
  5255.     CalcVisBehind calculates the visRgns of start Window and all windows
  5256. behind startWindow that intersect with clobberedRgn. It's called after 
  5257. PaintBehind (see  above).
  5258. \ TrackBox
  5259. 5
  5260. FUNCTION TrackBox (theWindow: WindowPtr; thePt: Point;
  5261.                     partCode: INTEGER) : BOOLEAN;
  5262.  
  5263.     When there’s a mouse-down event in the zoom-window box of theWindow,
  5264. the application should call TrackBox with thePt equal to the point
  5265. where the mouse button was pressed (in global coordinates, as stored
  5266. in the where field of the event record). The partCode parameter
  5267. contains the constant (either inZoomIn or inZoomOut) returned by
  5268. FindWindow. TrackBox keeps control until the mouse button
  5269. is released; it highlights the zoom-window box in the same way as
  5270. a window’s close box is highlighted. When the mouse button is released,
  5271. TrackBox unhighlights the zoom-window box and returns TRUE if
  5272. the mouse is inside the zoom-window box or FALSE if it’s outside
  5273. the box (in which case the application should do nothing).
  5274. \ ZoomWindow
  5275. 5
  5276. PROCEDURE ZoomWindow (theWindow: WindowPtr;
  5277.                         partCode: INTEGER; front: BOOLEAN);
  5278.  
  5279.     Call ZoomWindow after a call to TrackBox that returns TRUE.
  5280. The partCode parameter contains the constant (either inZoomIn or
  5281. inZoomOut) returned by FindWindow. The window will be zoomed either
  5282. out or in, depending on the state of the window specified by partCode.
  5283. If the window is already in the state specified by partCode, ZoomWindow
  5284. does nothing. If the front parameter is TRUE, the window will be
  5285. brought to the front; otherwise, the window is left where it is.
  5286. (This means a window can be zoomed without necessarily becoming
  5287. the active window.)
  5288.  
  5289.     For best results, call the QuickDraw procedure EraseRect with the
  5290. portRect field of theWindow’s grafPort before calling ZoomWindow.
  5291.  
  5292. Warning:  Using the QuickDraw procedure SetPort, set thePort to the
  5293.           window’s port before calling ZoomWindow.
  5294.  
  5295. Note:     ZoomWindow is in no way tied to the TrackBox function and
  5296.           could just as easily be called in response to a selection
  5297.           from a menu.
  5298. \ NewControl
  5299. 6
  5300. FUNCTION NewControl (theWindow: WindowPtr; boundsRect: Rect; title:
  5301.                     Str255; visible: BOOLEAN; value: INTEGER;
  5302.                     min,max: INTEGER; procID: INTEGER; refCon: LongInt)
  5303.                     : ControlHandle;
  5304.  
  5305.  
  5306.     NewControl creates a control, adds it to the beginning of
  5307. theWindow's control list, and returns a handle to the new control. The
  5308. values passed as parameters are stored in the corresponding fields of
  5309. the control record, as described below. The field that determines
  5310. highlighting is set to Ø (no highlighting) and the pointer to the
  5311. default action procedure is set to NIL (none).
  5312.  
  5313. (note)
  5314.     The control definition function may do additional
  5315.     initialization, including changing any of the fields of
  5316.     the control record. The only standard control for which
  5317.     additional initialization is done is the scroll bar; its
  5318.     control definition function allocates space for a region
  5319.     to hold the thumb and stores the region handle in the
  5320.     contrlData field of the control record.
  5321.  
  5322.     TheWindow is the window the new control will belong to. All
  5323. coordinates pertaining to the control will be interpreted in this
  5324. window's local coordinate system.
  5325.  
  5326.     BoundsRect, given in theWindow's local coordinates, is the rectangle 
  5327. that encloses the control and thus determines its size and location.
  5328. Note the following about the enclosing rectangle for the standard
  5329. controls:
  5330.  
  5331.       - Simple buttons are drawn to fit the rectangle exactly. (The
  5332.         control definition function calls the QuickDraw procedure
  5333.     FrameRoundRect.)  To allow for the tallest characters in the
  5334.     system font, there should be at least a 2Ø-point difference
  5335.     between the top and bottom coordinates of the rectangle.
  5336.  
  5337.       - For check boxes and radio buttons, there should be at least a
  5338.     16-point difference between the top and bottom coordinates.
  5339.  
  5340.       - By convention, scroll bars are 16 pixels wide, so there should be
  5341.     a 16-point difference between the left and right (or top and
  5342.     bottom) coordinates. If there isn't, the scroll bar will be 
  5343.     scaled to fit the rectangle.
  5344.  
  5345.     Title is the control's title, if any (if none, you can just pass the 
  5346. empty string as the title). Be sure the title will fit in the
  5347. control's enclosing rectangle; if it won't, it will be truncated on the
  5348. right for check boxes and radio buttons, or centered and truncated on
  5349. both ends for simple buttons.
  5350.  
  5351.     If the visible parameter is TRUE, NewControl draws the control.
  5352.  
  5353. (note)
  5354.     It does NOT use the standard window updating mechanism,
  5355.     but instead draws the control immediately in the window.
  5356.  
  5357.     The min and max parameters define the control's range of possible 
  5358. settings; the value parameter gives the initial setting. For controls
  5359. that don't retain a setting, such as buttons, the values you supply for 
  5360. these parameters will be stored in the control record but will never be
  5361. used. So it doesn't matter what values you give for those controls--Ø
  5362. for all three parameters will do. For controls that just retain an
  5363. on-or-off setting, such as check boxes or radio buttons, min should be
  5364. Ø (meaning the control is off) and max should be 1 (meaning it's on).
  5365. For dials, you can specify whatever values are appropriate for min,
  5366. max, and value.
  5367.  
  5368.     ProcID is the control definition ID, which leads to the control
  5369. definition function for this type of control. The control definition
  5370. IDs for the standard control types are listed above under "Controls and 
  5371. Resources". Control definition IDs for custom control types are 
  5372. discussed later under "Defining Your Own Controls".
  5373.  
  5374.     RefCon is the control's reference value, set and used only by your 
  5375. application.
  5376. \ GetNewControl
  5377. 6
  5378. FUNCTION GetNewControl (controlID: INTEGER; theWindow: WindowPtr)
  5379.                         : ControlHandle;
  5380.  
  5381.     GetNewControl creates a control from a control template stored in a
  5382. resource file, adds it to the beginning of theWindow's control list, 
  5383. and returns a handle to the new control. ControlID is the resource ID
  5384. of the template. GetNewControl works exactly the same as NewControl
  5385. (above), except thatt it gets the initial values for the new control's
  5386. fields from the specified control template instead of accepting them as
  5387. parameters.
  5388. \ DisposeControl
  5389. 6
  5390. PROCEDURE DisposeControl (theControl: ControlHandle);
  5391.  
  5392.     DisposeControl removes theControl from the screen, deletes it from
  5393. its window's control list, and releases the memory occupied by the
  5394. control record and all data structures associated with the control.
  5395. \ KillControls
  5396. 6
  5397. PROCEDURE KillControls (theWindow: WindowPtr);
  5398.  
  5399.     KillControls disposes of all controls associated with theWindow by
  5400. calling DisposeControl (above) for each.
  5401. \ SetCTitle
  5402. 6
  5403. PROCEDURE SetCTitle (theControl: ControlHandle; title: Str255);
  5404.  
  5405.     SetCTitle sets theControl's title to the given string and redraws
  5406. the control.
  5407. \ GetCTitle
  5408. 6
  5409. PROCEDURE GetCTitle (theControl: ControlHandle; VAR title: Str255);
  5410.  
  5411.     GetCTitle returns theControl's title as the value of the title 
  5412. parameter.
  5413. \ HideControl
  5414. 6
  5415. PROCEDURE HideControl (theControl: ControlHandle);
  5416.  
  5417.     HideControl makes theControl invisible. It fills the region the
  5418. control occupies within its window with the background pattern of the
  5419. window's grafPort. It also adds the control's enclosing rectangle to
  5420. the window's update region, so that anything else that was previously 
  5421. obscured by the control will reappear on the screen. If the control is
  5422. already invisible, HideControl has no effect.
  5423. \ ShowControl
  5424. 6
  5425. PROCEDURE ShowControl (theControl: ControlHandle);
  5426.  
  5427.     ShowControl makes theControl visible. The control is drawn in its
  5428. window but may be completely or partially obscured by overlapping
  5429. windows or other objects. If the control is already visible,
  5430. ShowControl has no effect.
  5431. \ DrawControls
  5432. 6
  5433. PROCEDURE DrawControls (theWindow: WindowPtr);
  5434.  
  5435.     DrawControls draws all controls currently visible in theWindow. The
  5436. controls are drawn in reverse order of creation; thus in case of
  5437. overlap the earliest-created controls appear frontmost in the window.
  5438.  
  5439. (note)
  5440.     WindowManager routines such as SelectWindow, ShowWindow,
  5441.     and BringToFront do not automatically call DrawControls
  5442.     to display the window's controls. They just add the 
  5443.     appropriate regions to the window's update region, 
  5444.     generating an update event. Your program should always
  5445.     call DrawControls explicitly upon receiving an update
  5446.     event for a window that contains controls.
  5447. \ HiliteControl
  5448. 6
  5449. PROCEDURE HiliteControl (theControl: ControlHandle; hiliteState:
  5450.                         INTEGER);
  5451.  
  5452.     HiliteControl changes the way theControl is highlighted. HiliteState
  5453. is an integer between Ø and 255;
  5454.  
  5455.        - A value of Ø means no highlighting.
  5456.  
  5457.        - A value between 1 and 253 is interpreted as a part code
  5458.          designating the part of the control to be highlighted.
  5459.  
  5460.        - A value of 254 or 255 means that the control is to be made
  5461.          inactive and highlighted accordingly. Usually you'll want to
  5462.          use 254, because it enables you to detect when the mouse button
  5463.          was pressed in the inactive control as opposed to not in any
  5464.          control;
  5465.          for more information, see FindControl under "Mouse Location"
  5466.          below.
  5467.  
  5468.     Hilite Control calls the control definition function to redraw the
  5469. control with its new highlighting.
  5470. \ TestControl
  5471. 6
  5472. FUNCTION TestControl (theControl: ControlHandle; thePoint: Point)
  5473.                         :  INTEGER;
  5474.  
  5475.     If theControl is visible and active, TestControl tests which part of
  5476. the control contains thePoint (in the local coordinates of the
  5477. control's window); it returns the corresponding part code, or Ø if the 
  5478. point is outside the control. If the control is visible and inactive
  5479. with 254 highlighting, TestControl returns 254. If the control is
  5480. invisible, or inactive with 255 highlighting, TestControl returns Ø.
  5481. \ FindControl
  5482. 6
  5483. FUNCTION FindControl (thePoint: Point; theWindow: WindowPtr; VAR
  5484.                         whichControl: ControlHandle) : INTEGER;
  5485.  
  5486.     When the Window Manager function FindWindow reports that the mouse
  5487. button was pressed in the content region of a window, and the window
  5488. contains controls, the application should call FindControl with
  5489. theWindow equal to the window pointer and thePoint equal to the point
  5490. where the mouse button was pressed (in the window's local coordinates).
  5491. FindControl tells which of the window's controls, if any, the mouse 
  5492. button was pressed in:
  5493.  
  5494.       - If it was pressed in a visible, active control, FindControl sets
  5495.         the whichControl parameter to the control handle and returns a
  5496.         part code identifying the part of the control that it was
  5497.         pressed in.
  5498.  
  5499.       - If it was pressed in a visible, inactive control with 254
  5500.         highlighting, FindControl sets whichControl to the control
  5501.         handle and returns 254 as its result.
  5502.  
  5503.       - If it was pressed in an invisible control, an inactive control
  5504.         with 255 highlighting, or not in any control, FindControl sets
  5505.         whichControl to NIL and returns Ø as its result.
  5506.  
  5507. (warning)
  5508.     Notice that FindControl expects the mouse point in the
  5509.     window's local coordinates, whereas FindWindow expects it 
  5510.     in global coordinates. Always be sure to convert the
  5511.     point to local coordinates with the QuickDraw procedure
  5512.     GlobalToLocal before calling FindControl.
  5513.  
  5514. (note)
  5515.     FindControl also returns NIL for whichControl and Ø as
  5516.     its result if the window is invisible or doesn't contain 
  5517.     the given point. In these cases, however, FindWindow
  5518.     wouldn't have returned this window in the first place, so 
  5519.     the situation should never arise.
  5520. \ TrackControl
  5521. 6
  5522. FUNCTION TrackControl (theControl: ControlHandle; startPt: Point;
  5523.     actionProc: ProcPtr) : INTEGER;
  5524.  
  5525.     When the mouse button is pressed in a visible, active control, the
  5526. application should call TrackControl with theControl equal to the
  5527. control handle and startPt equal to the point where the mouse button
  5528. was pressed (in the local coordinates of the control's window).
  5529. TrackControl follows the movements of the mouse and responds in
  5530. whatever way is appropriate until the mouse button is released; the
  5531. exact response depends on the type of control and the part of the
  5532. control in which the mouse button was pressed. If highlighting is
  5533. appropriate, TrackControl does the highlighting, and undoes it before
  5534. returning. When the mouse button is released, TrackControl returns
  5535. with the part code if the mouse is in the same part of the control that
  5536. it was originally in, or with Ø if not (in which case the application
  5537. should do nothing.
  5538.  
  5539.     If the mouse button was pressed in an indicator, TrackControl drags
  5540. a gray outline of it to follow the mouse (by calling the Window Manager
  5541. utility function DragGrayRgn). When the mouse button is released,
  5542. TrackControl calls the control definition function to reposition the
  5543. control's indicator. The control definition function for scroll bars 
  5544. responds by redrawing the thumb, calculating  the control's current 
  5545. setting based on the new relative position of the thumb, and storing
  5546. the current setting in the control record; for example, if the minimum
  5547. and maximum settings are  Ø and 1Ø, and the thumb is in the middle of
  5548. the scroll bar, 5 is stored as the current setting. The application
  5549. must then scroll to the corresponding relative position in the
  5550. document.
  5551.  
  5552.     TrackControl may take additional actions beyond highlighting the
  5553. control or dragging the indicator, depending on the value passed in the
  5554. actionProc parameter, as described below. Here you'll learn what to 
  5555. pass for the standard control types; for a custom control, what you
  5556. pass will depend on how the control is defined.
  5557.  
  5558.       - If actionProc is NIL, TrackControl performs no additional
  5559.         actions. This is appropriate for simple buttons, check boxes,
  5560.         radio buttons, and the thumb of a scroll bar.
  5561.  
  5562.       - ActionProc may be a pointer to an action procedure that defines
  5563.         some action to be performed repeatedly for as long as the user
  5564.         holds down the mouse button. (See below for details)
  5565.  
  5566.       - If actionProc is POINTER(-1), TrackControl looks in the control
  5567.         record for a pointer to the control's default action procedure. 
  5568.         If that field of the control record contains a procedure
  5569.         pointer, TrackControl uses the action procedure it points to; if
  5570.         the field contains POINTER(-1), TrackControl calls the control
  5571.         definition function to perform the necessary action. (If the
  5572.         field contains NIL, TrackControl does nothing.)
  5573.  
  5574.     The action procedure in the control definition function is described
  5575. in the section "Defining Your Own Controls". The following paragraphs
  5576. describe only the action procedure whose pointer is passed in the
  5577. actionProc parameter or stored in the control record.
  5578.  
  5579.     If the mouse button was pressed in an indicator, the action
  5580. procedure (if any) should have no parameters. This procedure must allow
  5581. for the fact that the mouse may not be inside the original control part.
  5582.  
  5583.     If the mouse button was pressed in a control part other than an
  5584. indicator, the action procedure should be of the form
  5585.  
  5586.     PROCEDURE MyAction (theControl: ControlHandle; partCode: INTEGER);
  5587.  
  5588.     In this case, TrackControl passes the control handle and the part
  5589. code to the action procedure. (It passes Ø in the partCode parameter if
  5590. the mouse has moved outside the original control part.)  As an example
  5591. of this type of action procedure, consider what should happen when the
  5592. mouse button is pressed in a scroll arrow or paging region in a scroll
  5593. bar. For these cases, your action procedure should examine the part
  5594. code to determine exactly where the mouse button was pressed, scroll up
  5595. or down a line or page as appropriate, and call SetCt1Value to change
  5596. the control's setting and redraw the thumb.
  5597.  
  5598. (warning)
  5599.     Since it has a different number of parameters depending
  5600.     on whether the mouse button was pressed in an indicator
  5601.     or elsewhere, the action procedure you pass to
  5602.     TrackControl (or whose pointer you store in the control
  5603.     record) can be set up for only one case or the other. If
  5604.     you store a pointer to a default action procedure in a
  5605.     control record, be sure it will be used only when
  5606.     appropriate for that type of action procedure. The only
  5607.     way to specify actions in response to all mouse-down
  5608.     events in a control, regardless of whether they're in an 
  5609.     indicator, is via the control definition function.
  5610. \ MoveControl
  5611. 6
  5612. PROCEDURE MoveControl (theControl: ControlHandle; h,v: INTEGER);
  5613.  
  5614.     MoveControl moves theControl to a new location within its window.
  5615. The top left corner of the control's enclosing rectangle is moved to the 
  5616. horizontal and vertical coordinates h and v (given in the local
  5617. coordinates of the control's window);  the bottom right corner is 
  5618. adjusted accordingly, to keep the size of the rectangle the same as
  5619. before. If the control is currently visible, it's hidden and then 
  5620. redrawn at its new location.
  5621.  
  5622. \ DragControl
  5623. 6
  5624. PROCEDURE DragControl (theControl: ControlHandle; startPt: Point;
  5625.                         limitRect,slopRect: Rect; axis: INTEGER);
  5626.  
  5627.     Called with the mouse button down inside theControl, DragControl
  5628. pulls a gray outline of the control around the screen, following the
  5629. movements of the mouse until the button is released. When the mouse
  5630. button is released, DragControl calls MoveControl to move the control
  5631. to the location to which it was dragged.
  5632.  
  5633. (note)
  5634.     Before beginning to follow the mouse, DragControl calls
  5635.     the control definition function to allow it to do its own
  5636.     "custom dragging" if it chooses. If the definition
  5637.     function doesn't choose to do any custom dragging, 
  5638.     DragControl uses the default method of dragging described
  5639.     here.
  5640.  
  5641.     DragControl calls the Window Manager utility function DragGrayRgn
  5642. and then moves the control accordingly. The startPt, limitRect,
  5643. slopRect, and axis parameters have the same meaning as for DragGrayRgn.
  5644. These parameters are reviewed briefly below; see the description of
  5645. DragGrayRgn in the Window Manager manual for more details.
  5646.  
  5647.       - StartPt parameter is assumed to be the point where the mouse
  5648.         button was originally pressed, in the local coordinates of the
  5649.         control's window. 
  5650.  
  5651.       - LimitRect limits the travel of the control's outline, and should 
  5652.         normally coincide with or be contained within the window's
  5653.         content region.
  5654.  
  5655.       - SlopRect allows the user some "slop" in moving the mouse; it
  5656.         should completely enclose limitRect.
  5657.  
  5658.       - The axis parameter allows you to constrain the control's motion to
  5659.         only one axis. It has one of the following values:
  5660.  
  5661.     CONST noConstraint  =   Ø;  {no constraint}
  5662.           hAxis Only    =   1;  {horizontal axis only}
  5663.           vAxis Only    =   2;  {vertical axis only}
  5664. \ Size Control
  5665. 6
  5666. PROCEDURE SizeControl (theControl: ControlHandle; w,h: INTEGER);
  5667.  
  5668.     SizeControl changes the size of theControl's enclosing rectangle.
  5669. The bottom right corner of the rectangle is adjusted to set the
  5670. rectangle's width and height to the number of pixels specified by w and
  5671. h; the position of the top left corner is not changed. If the control
  5672. is currently visible, it's hidden and then redrawn in its new size.
  5673. \ SetCtlValue
  5674. 6
  5675. PROCEDURE SetCtlValue (theControl: ControlHandle; theValue: INTEGER);
  5676.  
  5677.     SetCtlValue sets theControl's current setting to theValue and
  5678. redraws the control to reflect the new setting. For check boxes and
  5679. radio buttons, the value 1 fills the control with the appropriate mark,
  5680. and Ø clears it. For scroll bars, SetCtlValue redraws the thumb where
  5681. appropriate.
  5682.  
  5683.     If the specified value is out of range, it's forced to the nearest 
  5684. endpoint of the current range (that is, if theValue is less than the
  5685. minimum setting, SetCtlValue sets the current setting to the minimum;
  5686. if theValue is greater than the maximum setting, it sets the current
  5687. setting to the maximum.
  5688. \ GetCtlValue
  5689. 6
  5690. FUNCTION GetCtlValue (theControl: ControlHandle) : INTEGER;
  5691.  
  5692.     GetCtlValue returns theControl's current setting. 
  5693. \ SetCtlMin
  5694. 6
  5695. PROCEDURE SetCtlMin (theControl: ControlHandle; minValue: INTEGER;
  5696.  
  5697.     SetCtlMin sets theControl's minimum setting to minValue and redraws
  5698. the control to reflect the new range. If the control's current setting
  5699. is less than minValue, the setting is changed to the new minimum.
  5700. \ GetCtlMin
  5701. 6
  5702. FUNCTION GetCtlMin (theControl: ControlHandle) : INTEGER;
  5703.  
  5704.     GetCtlMin returns theControl's minimum setting.
  5705. \ SetCtlMax
  5706. 6
  5707. PROCEDURE SetCtlMax (theControl: ControlHandle; maxValue: INTEGER);
  5708.  
  5709.     SetCtlMax sets theControl maximum setting to maxValue and redraws
  5710. the control to reflect the new range. If maxValue is less than the
  5711. control's current setting, the setting is changed to the new maximum.
  5712. \ GetCtlMax
  5713. 6
  5714. FUNCTION GetCtlMax (theControl: ControlHandle) : INTEGER;
  5715.  
  5716.     GetCtlMax returns theControl's maximum setting.
  5717. \ SetCRefCon
  5718. 6
  5719. PROCEDURE SetCRefCon (theControl: ControlHandle; data: LongInt);
  5720.  
  5721.     SetCRefCon sets theControl's reference value to the given data.
  5722. \ GetCRefCon
  5723. 6
  5724. FUNCTION GetCRefCon (theControl: ControlHandle) : LongInt;
  5725.  
  5726.     GetCRefCon returns theControl's current reference value.
  5727. \ SetCtlAction
  5728. 6
  5729. PROCEDURE SetCtlAction (theControl: ControlHandle; actionProc:
  5730.                         ProcPtr);
  5731.  
  5732.     SetCtlAction sets theControl's default action procedure to
  5733. actionProc.
  5734. \ GetCtlAction
  5735. 6
  5736. FUNCTION GetCtlAction (theControl: ControlHandle) : ProcPtr;
  5737.  
  5738.     GetCtlAction returns a pointer to theControl's default action 
  5739. procedure, if any. (It returns whatever is in that field of the
  5740. control record.)
  5741.  
  5742.  
  5743. The Control Definition Function
  5744. -------------------------------
  5745.  
  5746.     The control definition function may be written in Pascal or assembly
  5747. language; the only requirement is that its entry point must be at the
  5748. beginning. You can give your control definition function any name you
  5749. like. Here's how you would declare one named MyControl:
  5750.  
  5751.     FUNCTION MyControl (varCode: INTEGER; theControl; ControlHandle;
  5752.                         message: INTEGER; param: LongInt) : LongInt;
  5753.  
  5754. VarCode is the variation code, as described above.
  5755.  
  5756. TheControl is a handle to the control that the operation will affect.
  5757.  
  5758. The message parameter identifies the desired operation. It has one of
  5759. the following values:
  5760.  
  5761.   CONST drawCntl = Ø;   {draw the control (or control part)}
  5762.     testCntl     = 1;   {test where mouse button was pressed}
  5763.     calcCrgns    = 2;   {calculate control's region (or indicator's)}
  5764.     initCntl     = 3;   {do any additional control initialization}
  5765.     dispCntl     = 4;   {take any additional disposal actions}
  5766.     posCntl      = 5;   {reposition control's indicator and update it}
  5767.     thumbCntl    = 6;   {calculate parameters for dragging indicator}
  5768.     dragCntl     = 7;   {drag control (or its indicator)}
  5769.     autoTrack    = 8;   {execute control's action procedure}
  5770.  
  5771.     As described below in the discussions of the routines that perform
  5772. these operations, the value passed for param, the last parameter of the
  5773. control definition function, depends on the operation. Where it's not 
  5774. mentioned below, this parameter is ignored. Similarly, the control
  5775. definition function is expected to return a function result only where
  5776. indicated; in other cases, the function should return Ø.
  5777.  
  5778. (note)
  5779.     "Routine" here does not necessarily mean a procedure or
  5780.      function. While it's a good idea to set these up as 
  5781.      subprograms inside the control definition function,
  5782.      you're not required to do so.
  5783. \ UpdtControl
  5784. 6
  5785. PROCEDURE UpdtControl (theWindow: WindowPtr; updateRgn: RgnHandle);
  5786.  
  5787.     UpdtControl is a faster version of the DrawControls procedure.
  5788. Instead of drawing all of the controls in theWindow, UpdtControl
  5789. draws only the controls that are in the specified update region.
  5790. UpdtControl is called in response to an update event, and is usually
  5791. bracketed by calls to the Window Manager procedures BeginUpdate and
  5792. EndUpdate. UpdateRgn should be set to the visRgn of theWindow’s port
  5793. (for more details, see the BeginUpdate procedure in the Window Manager
  5794. chapter).
  5795.  
  5796. Note:  In general, controls are in a dialog box and are automatically
  5797. drawn by the DrawDialog procedure.
  5798. \ Draw1Control
  5799. 6
  5800. PROCEDURE Draw1Control (theControl: ControlHandle);
  5801.  
  5802.     Draw1Control draws the specified control if it’s visible within the
  5803. window.
  5804. \ InitMenus
  5805. 7
  5806. PROCEDURE InitMenus;
  5807.  
  5808.     InitMenus initializes the Menu Manager. It allocates space for the
  5809. menu list (a relocatable block on the heap large enough for the maximum
  5810. size menu list), and draws the (empty) menu bar. Call InitMenus once
  5811. before all other Menu Manager routines. An application should never
  5812. have to call this procedure more than once; to start afresh with all
  5813. new menus, use ClearMenuBar.
  5814.  
  5815. (note)
  5816.     The Window Manager initialization procedure InitWindows
  5817.     has already drawn the empty menu bar; InitMenus redraws
  5818.     it.
  5819. \ NewMenu
  5820. 7
  5821. FUNCTION NewMenu (menuID: INTEGER; MenuTitle: Str255) : MenuHandle;
  5822.  
  5823.     NewMenu allocates space for a new menu with the given menu ID and
  5824. title, and returns a handle to it. It sets up the menu to use the
  5825. standard menu definition procedure. The new menu (which is created
  5826. empty) is not installed in the menu list. To use this menu, you must
  5827. first call AppendMenu or AddResMenu to fill it with items, InsertMenu
  5828. to place it in the menu list, and DrawMenuBar to update the menu bar to
  5829. include the new title.
  5830.  
  5831.     Application menus should always have positive menu IDs. Negative
  5832. menu IDs are reserved for menus belonging to desk accessories. No menu
  5833. should ever have a menu ID of Ø.
  5834.  
  5835.     If you want to set up the title of the Apple menu from your program
  5836. instead of reading it in from a resource file, you can use the
  5837. predefined constant appleMark (equal to $14, the value of the apple
  5838. symbol). For example, you can declare the string variable
  5839.  
  5840.     VAR myTitle: STRING[1];
  5841.  
  5842. and do the following:
  5843.  
  5844.     myTitle := ' ';
  5845.     myTitle[1] := CHR(appleMark)
  5846.  
  5847.     To release the memory occupied by a menu that you created with
  5848. NewMenu, call DisposeMenu.
  5849. \ GetMenu
  5850. 7
  5851. FUNCTION GetMenu (resourceID: INTEGER) : MenuHandle;
  5852.  
  5853.     GetMenu returns a menu handle for the menu having the given resource
  5854. ID. It calls the Resource Manager to read the menu from the resource
  5855. file into a menu record in memory. It stores the handle to the menu
  5856. definition procedure in the menu record, reading the procedure from the
  5857. resource file into memory if necessary. To use this menu, you must
  5858. call InsertMenu to place it in the menu list and DrawMenuBar to update
  5859. the menu bar to include the new title.
  5860.  
  5861. (warning)
  5862.     Only call GetMenu once for a particular menu. If you
  5863.     need the menu handle to a menu that's already in memory, 
  5864.     use the Resource Manager function GetResource.
  5865.  
  5866.     To release the memory occupied by a menu that you read from a
  5867. resource file with GetMenu, use the Resource Manager procedure
  5868. ReleaseResource.
  5869. \ DisposeMenu
  5870. 7
  5871. PROCEDURE DisposeMenu (theMenu: MenuHandle);
  5872.  
  5873.     Call ÎisposeMenu to release the memory occupied by a menu that you
  5874. allocated with NewMenu. (For menus read from a resource file with
  5875. GetMenu, use the Resource Manager procedure ReleaseResource instead.)
  5876. This is useful if you've created temporary menus that you no longer
  5877. need.
  5878.  
  5879. (warning)
  5880.     Make sure you remove the menu from the menu list (with
  5881.     DeleteMenu) before disposing of it. Also be careful not
  5882.     to use the menu handle after disposing of the menu.
  5883.  
  5884.  
  5885. \ AppendMenu
  5886. 7
  5887. PROCEDURE AppendMenu (theMenu: MenuHandle; data: Str255);
  5888.  
  5889.     AppendMenu adds an item or items to the end of the given menu, which
  5890. must previously have been allocated by NewMenu or read from a resource
  5891. file by GetMenu. The data string consists of the text of the menu
  5892. item; it may be blank but should not be the null string. If it begins
  5893. with a hyphen (-), the item will be a dividing line across the width of
  5894. the menu. As described in the section "Creating a Menu in Your 
  5895. Program", the following meta-characters may be embedded in the data
  5896. string:
  5897.  
  5898.    Meta-character     Usage
  5899.    --------------     -----
  5900.  
  5901.     ; or Return       Separates multiple items
  5902.     ^                 Followed by an icon number, adds that icon to
  5903.                       the item
  5904.     !                 Followed by a character, marks the item with
  5905.                       that character
  5906.     <                 Followed by B, I, U, O, or S, sets the
  5907.                       character style of the item
  5908.     /                 Followed by a character, associates a keyboard
  5909.                       equivalent with the item
  5910.     (                 Disables the item
  5911.  
  5912.     Once items have been appended to a menu, they cannot be removed or
  5913. rearranged. AppendMenu works properly whether or not the menu is in
  5914. the menu list.
  5915. \ AddResMenu
  5916. 7
  5917. PROCEDURE AddResMenu (theMenu: MenuHandle; theType: ResType);
  5918.  
  5919.     AddResMenu searches all open resource files for resources of type
  5920. theType and appends the names of all resources it finds to the given
  5921. menu. Each resource name appears in the menu as an enabled item,
  5922. without an icon or mark, and in the normal character style. The
  5923. standard Menu Manager calls can be used to get the name or change its
  5924. appearance, as described below under "Controlling Items' Appearance".
  5925.  
  5926. (note)
  5927.     So that you can have resources of the given type that
  5928.     won't appear in the menu, any resource names that begin 
  5929.     with a period (.) or a percent sign (%) aren't apppended 
  5930.     by AddResMenu.
  5931.  
  5932.     Use this procedure to fill a menu with the names of all available
  5933. fonts or desk accessories. For example, if you declare a variable as
  5934.  
  5935.     VAR fontMenu: MenuHandle;
  5936.  
  5937. you can set up a menu containing all font names as follows:
  5938.  
  5939.     fontMenu := NewMenu(5,'Fonts');
  5940.     AddResMenu(fontMenu,"FONT')
  5941. \ InsertResMenu
  5942. 7
  5943. Procedure InsertResMenu (theMenu: MenuHandle; theType: ResType;
  5944.                         afterItem: INTEGER);
  5945.  
  5946.     InsertResMenu is the same as AddRes˜enu (above) except that it
  5947. inserts the resource names in the menu where specified by the afterItem
  5948. parameter:  if afterItem is Ø, the names are inserted before the first
  5949. menu item; if it's the item number of an item in the menu, they're
  5950. inserted after that item; if it's equal to or greater than the last
  5951. item number, they're appended to the menu.
  5952.  
  5953. (note)
  5954.     InsertResMenu inserts the names in the reverse of the
  5955.     order that AddResMenu appends them. For consistency
  5956.     between the applications in the appearance of menus, use
  5957.     AddResMenu instead of InsertResMenu if possible.
  5958. \ InsertMenu
  5959. 7
  5960. PROCEDURE InsertMenu (theMenu: MenuHandle; before ID: INTEGER);
  5961.  
  5962.     InsertMenu inserts a menu into the menu list before the menu whose
  5963. menu ID equals beforeID. If beforeID is Ø (or isn't the ID of any menu
  5964. in the menu list), the new menu is added after all others. If the menu
  5965. is already in the menu list or the menu list is already full, InsertMenu
  5966. does nothing. Be sure to call DrawMenuBar to update the menu bar.
  5967. \ DrawMenuBar
  5968. 7
  5969. PROCEDURE DrawMenuBar;
  5970.  
  5971.     DrawMenuBar redraws the menu bar according to the menu list,
  5972. incorporating any changes since the last call to DrawMenuBar. Any
  5973. highlighted menu title remains highlighted when drawn by DrawMenuBar.
  5974. This procedure should always be called after a sequence of InsertMenu
  5975. or DeleteMenu calls, and after ClearMenuBar, SetMenuBar, or any other
  5976. routine that changes the menu list.
  5977. \ DeleteMenu
  5978. 7
  5979. PROCEDURE DeleteMenu (menuID: INTEGER);
  5980.  
  5981.     DeleteMenu deletes a menu from the menu list. If there's no menu
  5982. with the given menu ID in the menu list, DeleteMenu has no effect. Be
  5983. sure to call DrawMenuBar to update the menu bar; the menu titles
  5984. following the deleted menu will move over to fill the vacancy.
  5985.  
  5986. (note)
  5987.     DeleteMenu simply removes the menu from the list of
  5988.     currently available menus; it doesn't release the memory 
  5989.     occupied by the menu data structure.
  5990. \ ClearMenuBar
  5991. 7
  5992. PROCEDURE ClearMenuBar;
  5993.  
  5994.  
  5995.     Call ClearMenuBar to remove all menus from the menu list when you
  5996. want to start afresh with all new menus. Be sure to call DrawMenuBar to
  5997. update the menu bar.
  5998.  
  5999. (note)
  6000.     ClearMenuBar, like Delete Menu, doesn't release the memory 
  6001.     occupied by the menu data structures; it merely removes
  6002.     them from the menu list.
  6003.  
  6004.     You don't have to call ClearMenuBar at the beginning of your
  6005. program, because InitMenus clears the menu list for you.
  6006. \ GetNewMBar
  6007. 7
  6008. FUNCTION GetNewMBar (menuBarID: INTEGER) : Handle;
  6009.  
  6010.     GetNewMBar creates a menu list as defined by the menu bar resource
  6011. having the given resource ID, and returns a handle to it. If the
  6012. resource isn't already in memory, GetNewMBar reads it into memory from 
  6013. the resource file. It calls GetMenu to get each of the individual
  6014. menus.
  6015.  
  6016.     To make the menu list created by  GetNew˜Bar the  current menu list,
  6017. call SetMenuBar. To release the memory occupied by the menu list, use
  6018. the Memory Manager procedure DisposHandle.
  6019.  
  6020. (warning)
  6021.  
  6022.     You don't have to know the indivudual menu IDs to use 
  6023.     GetNewMBar, but that doesn't mean you don't have to know
  6024.     them at all:  to do anything further with a particular
  6025.     menu, you have to know its ID or its handle (which you
  6026.     can get by passing the ID to GetMHandle, as described
  6027.     below under "Miscellaneous Routines").
  6028.  
  6029.  
  6030. \ GetMenuBar
  6031. 7
  6032. FUNCTION GetMenuBar : Handle;
  6033.  
  6034.     GetMenuBar creates a copy of the current menu list and returns a
  6035. handle to the copy. You can then add or remove menus from the menu list
  6036. (with InsertMenu, DeleteMenu, or ClearMenuBar), and later restore the
  6037. saved menu list with SetMenuBar. To release the memory occupied by the
  6038. saved menu list, use the Memory Manager procedure DisposHandle.
  6039.  
  6040. (warning)
  6041.     GetMenuBar doesn't copy the menus themselves, only a list 
  6042.     containing their handles. Do not dispose of any menus
  6043.     that might be in a saved menu list.
  6044. \ SetMenuBar
  6045. 7
  6046. PROCEDURE SetMenuBar (menuList: Handle);
  6047.  
  6048.     SetMenuBar copies the given menu list to the current menu list. You
  6049. can use this procedure to restore a menu list previously saved by
  6050. GetMenuBar, or pass it a handle returned by GetNewMBar. Be sure to
  6051. call DrawMenuBar to update the menu bar.
  6052. \ MenuSelect
  6053. 7
  6054. FUNCTION MenuSelect (startPt: Point) : LONGINT;
  6055.  
  6056.     When there's a mouse-down event in the menu bar, the application
  6057. should call MenuSelect with startPt equal to the point (in global
  6058. coordinates) where the mousebutton was pressed.  MenuSelect keeps
  6059. control until the mouse button is released, tracking the mouse, pulling
  6060. down menus as needed, and highlighting enabled menu items under the
  6061. cursor. When the mouse button is released over an enabled item in an
  6062. application menu, MenuSelect returns a long integer whose high-order
  6063. word is the menu ID of the menu, and whose low-order word is the menu
  6064. item number for the item chosen (see Figure 3). It leaves the selected
  6065. menu title highlighted. After performing the chosen task, your
  6066. application should call HiliteMenu(Ø) to remove the highlighting from
  6067. the menu title.
  6068.  
  6069.     If no choice is made, MenuSelect returns Ø in the high-order word of
  6070. the long integer, and the low-order word is undefined. This includes
  6071. the case where the mouse button is released over a disabled menu item
  6072. (such as Cut, Copy, Clear, or one of the dividing lines in Figure 3),
  6073. over any menu title, or outside the menu.
  6074.  
  6075.     If the mouse button is released over an enabled item in a menu
  6076. belonging to a desk accessory, MenuSelect passes the menu ID and item
  6077. number to the Desk Manager procedure SystemMenu for processing, and
  6078. returns Ø to your application in the high-order word of the result.
  6079. \ MenuKey
  6080. 7
  6081. FUNCTION MenuKey (ch: CHAR) : LONGINT;
  6082.  
  6083.     MenuKey maps the given character to the associated menu and item for
  6084. that character. When you get a key-down event with the Command key
  6085. held down--or an auto-key event, if the command being invoked is
  6086. repeatable--call MenuKey with the character that was typed. MenuKey
  6087. highlights the appropriate menu title, and returns a long integer
  6088. containing the menu ID in its high-order word and the menu item number
  6089. in its low-order word, just as MenuSelect does (see Figure 3 above).
  6090. After performing the chosen task, your application should call
  6091. HiliteMenu(Ø) to remove the highlighting from the menu title.
  6092.  
  6093.     If the given character isn't associated with any enabled menu item 
  6094. currently in the menu list, MenuKey returns Ø in the high-order word of
  6095. the long integer, and the low-order word is undefined.
  6096.  
  6097.     If the given character involes a menu item in a menu belonging to a
  6098. desk accessory, MenuKey (like MenuSelect) passes the menu ID and item
  6099. number to the Desk Manager procedure SystemMenu for processing, and
  6100. returns Ø to your application in the high-order word of the result.
  6101.  
  6102. (note)
  6103.     There should never be more than one item in the menu list
  6104.     with the same keyboard equivalent, but if there is,
  6105.     MenuKey returns the first such item it encounters,
  6106.     scanning the menus from right to left and their items
  6107.     from top to bottom.
  6108. \ HiliteMenu
  6109. 7
  6110. PROCEDURE HiliteMenu (menuID: INTEGER);
  6111.  
  6112.     Hilite Menu highlights the title of the given menu, or does nothing
  6113. if the title is already highlighted. Since only one menu title can be
  6114. highlighted at a time, it unhighlights any previously highlighted menu
  6115. title. If MenuID is Ø (or isn't the ID of any menu in the menu list),
  6116. HiliteMenu simply unhighlights whichever menu title is highlighted (if
  6117. any).
  6118.  
  6119.     After MenuSelect or MenuKey, your application should perform the
  6120. chosen task and then call HiliteMenu(Ø) to unhighlight the chosen menu
  6121. title.
  6122. \ SetItem
  6123. 7
  6124. PROCEDURE SetItem (theMenu: MenuHandle; item: INTEGER; itemString:
  6125.     Str255);
  6126.  
  6127.     SetItem changes the text of the given menu item to itemString. It
  6128. doesn't recognize the meta-characters used in AppendMenu; if you
  6129. include them in itemString, they will appear in the text of the menu
  6130. item. The attributes already in effect for this item--its character
  6131. style, icon, and so on--remain in effect. ItemString may be blank but
  6132. should not be the null string.
  6133.  
  6134. (note)
  6135.     It's good practice to store the text of itemString in a 
  6136.     resource file instead of passing it directly.
  6137.  
  6138.     Use SetItem to flip between two alternative menu items--for example,
  6139. to change "Show Clipboard" top "Hide Clipboard" when the Clipboard is
  6140. already showing.
  6141.  
  6142. (note)
  6143.     To avoid confusing the user, don't capriciously change 
  6144.     the text of menu items.
  6145. \ GetItem
  6146. 7
  6147. PROCEDURE GetItem (theMenu: MenuHandle; item: INTEGER; VAR itemString:
  6148.     Str255);
  6149.  
  6150.     GetItem returns the text of the given menu item in itemString. It
  6151. doesn't place any meta-characters in the string. This procedure is 
  6152. useful for getting the name of a menu item that was installed with
  6153. AddResMenu or InsertResMenu.
  6154. \ DisableItem
  6155. 7
  6156. PROCEDURE DisableItem (theMenu: MenuHandle; item: INTEGER);
  6157.  
  6158.     Given a menu item number in the item parameter, DisableItem disables
  6159. that menu item; given Ø in the item parameter, it disables the entire
  6160. menu.
  6161.  
  6162.     Disabled menu items appear dimmed and are not highlighted when the
  6163. cursor moves over them. MenuSelect and MenuKey return Ø in the high-
  6164. order word of their result if the user attempts to invoke a disabled
  6165. item. Use DisableItem to disable all menu choices that aren't
  6166. appropriate at a given time (such as a Cut command when there's no text
  6167. selection).
  6168.  
  6169.     All menu items are initially enabled unless you specify otherwise
  6170. (such as by using the "(" meta-character in a call to AppendMenu).
  6171.  
  6172.     Every menu item in a disabled menu is dimmed. The menu title is
  6173. also dimmed, but you must call DrawMenuBar to update the menu bar to
  6174. show the dimmed title.
  6175. \ EnableItem
  6176. 7
  6177. PROCEDURE EnableItem (theMenu:  MenuHandle; item: INTEGER);
  6178.  
  6179.     Given a menu item number in the item parameter, EnableItem enables
  6180. the item; given 0 in the item parameter, it enables the entire menu.
  6181. (The item or menu may have been disabled with the DisableItem procedure,
  6182. or the item may have been disabled with the "(" meta-character in the
  6183. AppendMenu string.)  The item or menu title will no longer appear
  6184. dimmed and can be chosen like any other enabled item or menu.
  6185. \ CheckItem
  6186. 7
  6187. PROCEDURE CheckItem (theMenu:  MenuHandle; item:  INTEGER; checked:
  6188.             BOOLEAN);
  6189.  
  6190.     CheckItem places or removes a check mark at the left of the given
  6191. menu item. After you call CheckItem with checked=TRUE, a check mark
  6192. will appear each subsequent time the menu is pulled down. Calling
  6193. CheckItem with checked=FALSE removes the check mark from the menu item
  6194. (or, if it's marked with a different character, removes that mark).
  6195.  
  6196.     Menu items are initially unmarked unless you specify otherwise (such
  6197. as with the "!" meta-character in a call to AppendMenu).
  6198. \ SetItemMark
  6199. 7
  6200. PROCEDURE SetItemMark (theMenu: MenuHandle; item: INTEGER; markChar:
  6201.              CHAR);
  6202.  
  6203.     SetItemMark marks the given menu item in a more general manner than
  6204. CheckItem. It allows you to place any character in the system font,
  6205. not just the check mark, to the left of the item. You can specify some
  6206. useful values for the markChar parameter with the following predefined
  6207. constants:
  6208.  
  6209.        CONST noMark      = 0;      {NUL character, to remove a mark}
  6210.              commandMark = $11;    {Command key symbol}
  6211.              checkMark   = $12;    {check mark}
  6212.              diamondMark = $13;    {diamond symbol}
  6213.              appleMark   = $14;    {apple symbol}
  6214. \ GetItemMark
  6215. 7
  6216. PROCEDURE GetItemMark (theMenu: MenuHandle; item: INTEGER; VAR
  6217.             markChar: CHAR);
  6218.  
  6219.     GetItemMark returns in markChar whatever character the given menu
  6220. item is marked with, or the NUL character (ASCII code 0) if no mark is
  6221. present.
  6222. \ SetItemIcon
  6223. 7
  6224. PROCEDURE SetItemIcon (theMenu: MenuHandle; item: INTEGER; icon: Byte);
  6225.  
  6226.     SetItemIcon associates the given menu item with an icon. It sets
  6227. the item's icon number to the given value (an integer from 1 to 255).
  6228. The Menu Manager adds 256 to the icon number to get the icon's resource
  6229. ID, which it passes to the Resource Manager to get the corresponding
  6230. icon.
  6231.  
  6232. (warning)
  6233.        If you deal directly with the Resource Manager to read or
  6234.        store menu icons, be sure to adjust your icon numbers
  6235.        accordingly.
  6236.  
  6237. Menu items initially have no icons unless you specify otherwise (such
  6238. as with the "^" meta-character in a call to AppendMenu).
  6239. \ GetItemIcon
  6240. 7
  6241. PROCEDURE GetItemIcon (theMenu: MenuHandle; item: INTEGER; VAR icon:
  6242.                          Byte);
  6243.  
  6244.     GetItemIcon returns the icon number associated with the given menu
  6245. item, as an integer from 1 to 255, or 0 if the item has not been
  6246. associated with an icon. The icon number is 256 less than the icon's 
  6247. resource ID.
  6248. \ SetItemStyle
  6249. 7
  6250. PROCEDURE SetItemStyle (theMenu: MenuHandle; item: INTEGER; chStyle:
  6251.                         Style);
  6252.  
  6253.     SetItemStyle changes the character style of the given menu item to
  6254. chStyle. For example:
  6255.  
  6256.     SetItemStyle(thisMenu,1,[bold,italic])     {bold and italic}
  6257.  
  6258.     Menu items are initially in the normal character style unless you
  6259. specify otherwise (such as with the "<" meta-character in a call to
  6260. AppendMenu).
  6261. \ GetItemStyle
  6262. 7
  6263. PROCEDURE GetItemStyle (theMenu: MenuHandle; item: INTEGER; VAR
  6264.                         chStyle: Style);
  6265.  
  6266.     GetItemStyle returns the character style of the given menu item in
  6267. chStyle.
  6268. \ CalcMenuSize
  6269. 7
  6270. PROCEDURE CalcMenuSize (theMenu: MenuHandle);
  6271.  
  6272.     You can use CalcMenuSize to recalculate the horizontal and vertical
  6273. dimensions of a menu whose contents have been changed (and store them
  6274. in the appropriate fields of the menu record). CalcMenuSize is called
  6275. internally by the Menu Manager after every AppendMenu, SetItem,
  6276. SetItemIcon, and SetItemStyle call.
  6277. \ GetMHandle
  6278. 7
  6279. FUNCTION GetMHandle (menuID: INTEGER) : MenuHandle;
  6280.  
  6281.     Given the menu ID of a menu currently installed in the menu list,
  6282. GetMHandle returns a handle to that menu; given any other menu ID, it
  6283. returns NIL.
  6284. \ FlashMenuBar
  6285. 7
  6286. PROCEDURE FlashMenuBar (menuID: INTEGER);
  6287.  
  6288.     If menuID is 0 (or isn't the ID of any menu in the menu list),
  6289. FlashMenuBar inverts the entire menu bar; otherwise, it inverts the
  6290. title of the given menu.
  6291. \ SetMenuFlash
  6292. 7
  6293. PROCEDURE SetMenuFlash (count: INTEGER);
  6294.  
  6295.     When the mouse button is released over an enabled menu item, the
  6296. item blinks briefly to confirm the choice. Normally your application
  6297. shouldn't be concerned with this blinking; the user sets it with the
  6298. Control Panel desk accessory. If you're writing a desk accessory like
  6299. the Control Panel, though, SetMenuFlash allows you to control the
  6300. duration of this blinking. Count is the number of times menu items
  6301. will blink; it's initially 3 if the user hasn't changed it. A count of
  6302. 0 disables blinking. Values greater than 3 can be annoyingly slow.
  6303.  
  6304. (warning)
  6305.     Don't call SetMenuFlash from your main program.     
  6306.  
  6307. (note)
  6308.     Items in both standard and nonstandard menus blink when
  6309.     chosen. The appearance of the blinking for a nonstandard
  6310.     menu depends on the menu definition procedure, as
  6311.     described below.
  6312. \ InsMenuItem
  6313. 7
  6314. PROCEDURE InsMenuItem (theMenu: MenuHandle; itemString: Str255; afterItem: INTEGER);
  6315.  
  6316.     InsMenuItem inserts an item or items into the given menu where
  6317. specified by the afterItem parameter. If afterItem is 0, the items
  6318. are inserted before the first menu item; if it’s the item number of an
  6319. item in the menu, they’re inserted after that item; if it’s equal to or
  6320. greater than the last item number, they’re appended to the menu.
  6321.  
  6322. Warning:  Only the items contained in itemString are sorted.
  6323.  
  6324.     The contents of itemString are parsed as in the AppendMenu
  6325. procedure. Multiple items are inserted in the reverse of their order in
  6326. itemString.
  6327. \ DelMenuItem
  6328. 7
  6329. PROCEDURE DelMenuItem (theMenu: MenuHandle; item: INTEGER);
  6330.  
  6331.     DelMenuItem deletes the specified item from the given menu.
  6332.  
  6333. Note:  DelMenuItem is intended for maintaining dynamic menus (such as
  6334.        a list of open windows). It should not be used for disabling
  6335.        items; you should use DisableItem instead.
  6336. \ TEInit
  6337. 8
  6338. PROCEDURE TEInit;
  6339.  
  6340.     TEInit initializes TextEdit by allocating a handle for the TextEdit
  6341. scrap. The scrap is initially empty. Calll this procedure once and
  6342. only once at the beginning of your program.
  6343.  
  6344. (note)
  6345.       You should call TEInit even if your application doesn't
  6346.       use TextEdit, so that desk accessories and dialog and
  6347.       alert boxes will work correctly.
  6348. \ TENew
  6349. 8
  6350. FUNCTION TENew (destRect, viewRect: Rect) : TEHandle;
  6351.  
  6352.     TENew allocates a handle for the text, creates and initializes an
  6353. edit record, and returns a handle to the new edit record. DestRect and
  6354. viewRect are the destination and view rectangles, respectively. Both
  6355. rectangles are specified in the current grafPort's coordinates. The
  6356. destination rectangle must always be at least as wide as the first
  6357. character drawn (about 20 pixels is usually a good width). The view
  6358. rectangle must not be empty (for example, don't make its right edge
  6359. less than its left edge if you don't want any text visible--specify a 
  6360. rectangle off the screen instead).
  6361.  
  6362.     Call TENew once for every edit record you want allocated. The edit
  6363. record incorporates the drawing environment of the grafPort, and is
  6364. initialized for left-justified, single-spaced text with an insertion
  6365. point at character position 0.
  6366.  
  6367. (note)
  6368.       The caret won't appear until you call TEActivate.
  6369. \ TEDispose
  6370. 8
  6371. PROCEDURE TEDispose (hTE: TEHandle);
  6372.  
  6373.     TEDispose releases the memory allocated for the edit record and text
  6374. specified by hTE. Call this procedure when you're completely through
  6375. with an edit record.
  6376. \ TESetText
  6377. 8
  6378. PROCEDURE TESetText (text: Ptr; length: LONGINT; hTE: TEHandle);
  6379.  
  6380.     TESetText incorporates a copy of the specified text into the edit
  6381. record specified by hTE. The text parameter points to the text, and
  6382. the length paramenter indicates the number of characters in the text.
  6383. The selection range is set to an insertion point at the end of the
  6384. text. TESetText doesn't affect the text drawn in the destination
  6385. rectangle, so call TEUpdate afterward if necessary. TESetText doesn't 
  6386. dispose of any text currently in the edit record.
  6387. \ TEGetText
  6388. 8
  6389. FUNCTION TEGetText (hTE: TEHandle) : CharsHandle;
  6390.  
  6391.     TEGetText returns a handle to the text of the specified edit record.
  6392. The result is the same as the handle in the hText field of the edit
  6393. record, but has the CharsHandle data type, which is defined as:
  6394.  
  6395.        TYPE CharsHandle = ^CharsPtr;
  6396.             CharsPtr    = ^Chars;
  6397.         Chars       =PACKED ARRAY{0..3200] OF CHAR;
  6398.  
  6399.     You can get the length of the text from the teLength field of the
  6400. edit record.
  6401. \ TEIdle
  6402. 8
  6403. PROCEDURE TEIdle (hTE: TEHandle);
  6404.  
  6405.     Call TEIdle repeatedly to make a blinking caret appear at the
  6406. insertion point (if any) in the text specified by hTE. (The caret
  6407. appears only when the window containing that text is active, of course.)
  6408. TextEdit observes a minimum blink interval:  No mater how often  you
  6409. call TEIdle, the time between blinks will never be less than the
  6410. minimum interval.
  6411.  
  6412. (note)
  6413.       You actually need to call TEIdle only when the window
  6414.       containing the text is active.
  6415. \ TEClick
  6416. 8
  6417. PROCEDURE TEClick (pt: Point; extend: BOOLEAN; hTE: TEHandle);
  6418.  
  6419.     TEClick controls the placement and highlighting of the selection
  6420. range as determined by mouse events. Call TEClick whenever a mouse-down
  6421. event occurs in the view rectangle of the edit record specified by hTE,
  6422. and the window associated with that edit record is active. TEClick
  6423. keeps control until the mouse button is released. Pt is the mouse
  6424. location (in local coordinates) at the time the button was pressed,
  6425. obtainable from the event record.
  6426.  
  6427. (note)
  6428.       Use the QuickDraw procedure GlobalToLocal to convert the
  6429.       global coordinates of the mouse location given in the
  6430.       event record to the local coordinate system for pt.
  6431.  
  6432.     Pass TRUE for the extend parameter if the Event Manager indicates
  6433. that the Shift key was held down at the time of the click (to extend the
  6434. selection).
  6435.  
  6436.     TEClick unhighlights the old selection range unless the selection
  6437. range is being extended. If the mouse moves, meaning that a drag is
  6438. occurring, TEClick expands or shortens the selection range accordingly.
  6439. In the case of a double-click, the word under the cursor becomes the
  6440. selection range; dragging expands or shortens the selection a word at a
  6441. time.
  6442. \ TESetSelect
  6443. 8
  6444. PROCEDURE TESetSelect (selStart,selEnd: LONGINT; hTE: TEHandle);
  6445.  
  6446.     TESetSelect sets the selection range to the text between selStart
  6447. and selEnd in the text specified by hTE. The old selection range is
  6448. unhighlighted, and the new one is highlighted. If selStart equals
  6449. selEnd, the selection range is an insertion point, and a caret is
  6450. displayed
  6451.  
  6452.     SelEnd and selStart can range from 0 to 32767. If selEnd is
  6453. anywhere beyond the last character of the text, the position just past
  6454. the last character is used.
  6455. \ TEActivate
  6456. 8
  6457. PROCEDURE TEActivate (hTE: TEHandle);
  6458.  
  6459.     TEActivate highlights the selection range in the view rectangle of
  6460. the edit record specified by hTE. If the selection range is an
  6461. insertion point, it displays a caret there. This procedure should be
  6462. called every time the Toolbox Event Manager function GetNextEvent
  6463. reports that the window containing the edit record has become active.
  6464. \ TEDeactivate
  6465. 8
  6466. PROCEDURE TEDeactivate (hTE: TEHandle);
  6467.  
  6468.     TEDeactivate unhighlights the selection range in the view rectangle
  6469. of the edit record specified by hTE. If the selection range is an
  6470. insertion point, it removes the caret. This procedure should be called
  6471. every time the Toolbox Event Manager function GetNextEvent reports that
  6472. the window containing the edit record has become inactive.
  6473. \ TEKey
  6474. 8
  6475. PROCEDURE TEKey (key: CHAR; hTE: TEHandle);
  6476.  
  6477.     TEKey replaces the selection range in the text specified by hTE with
  6478. the character given by the key parameter, and leaves an insertion point
  6479. just past the inserted character. If the selection range is an
  6480. insertion point, TEKey just inserts the character there. If the key
  6481. parameter contains a Backspace character, the selection range or the
  6482. character immediately to the left of the insertion point is deleted.
  6483. TEKey redraws the text as necessary. Call TEKey every time the Toolbox
  6484. Event Manager function GetNextEvent reports a keyboard event that your
  6485. application decides should be handled by TextEdit.
  6486.  
  6487. (note)
  6488.       TEKey inserts every character passed in the key
  6489.       parameter, so it's up to your application to filter out
  6490.       all characters that aren't actual text (such as keys
  6491.       typed in conjuction with the Command key).
  6492. \ TECut
  6493. 8
  6494. PROCEDURE TECut (hTE: TEHandle);
  6495.  
  6496.     TECut removes the selection range from the text specified by hTE and
  6497. places it in the TextEdit scrap. The text is redrawn as necessary.
  6498. Anything previously in the scrap is lost. (See Figure 6.)  If the
  6499. selection range is an insertion point, the scrap is emptied.
  6500. \ TECopy
  6501. 8
  6502. PROCEDURE TECopy (hTE: TEHandle);
  6503.  
  6504.     TECopy copies the selection range from the text specified by hTE
  6505. into the TextEdit scrap. Anything previously in the scrap is deleted.
  6506. The selection range is not deleted. If the selection range is an
  6507. insertion point, the scrap is emptied.
  6508. \ TEPaste
  6509. 8
  6510. PROCEDURE TEPaste (hTE: TEHandle);
  6511.  
  6512.     TEPaste replaces the selection range in the text specified by hTE
  6513. with the contents of the TextEdit scrap, and leaves an insertion point
  6514. just past the inserted text. (See Figure 7.)  The text is redrawn as
  6515. necessary. If the scrap is empty, the selection range is deleted. If
  6516. the selection range is an insertion point, TEPaste just inserts the
  6517. scrap there.
  6518. \ TEDelete
  6519. 8
  6520. PROCEDURE TEDelete (hTE: TEHandle);
  6521.  
  6522.     TEDelete removes the selection range from the text specified by hTE,
  6523. and redraws the text as necessary. TEDelete is the same as TECut
  6524. (above) except that it doesn't transfer the selection range to the
  6525. scrap. If the selection range is an insertion point, nothing happens.
  6526. \ TEInsert
  6527. 8
  6528. PROCEDURE TEInsert (text: Ptr; length: LONGINT; hTE: TEHandle);
  6529.  
  6530.     TEInsert takes the specified text and inserts it just before the
  6531. selection range into the text indicated by hTE, redrawing the text as
  6532. necessary. The text parameter points to the text to be inserted, and
  6533. the length parameter indicates the number of characters to be inserted.
  6534. TEInsert doesn't affect either the current  selection range or the
  6535. scrap.
  6536. \ TESetJust
  6537. 8
  6538. PROCEDURE TESetJust (just: INTEGER, hTE: TEHandle);
  6539.  
  6540.     TESetJust sets the justification of the text specified by hTE to
  6541. just. (See"Justification" under "Edit Records".)  TextEdit provides
  6542. three predefined constants for setting justification:
  6543.  
  6544.         CONST: teJustLeft   = 0;
  6545.                teJustCenter = 1;
  6546.                teJustRight  = -1;
  6547.  
  6548.     By default, text is left-justified. If you change the
  6549. justification, call TEUpdate after TESetJust, to redraw the text with
  6550. the new justification.
  6551. \ TEUpdate
  6552. 8
  6553. PROCEDURE TEUpdate (rUpdate: Rect; hTE: TEHandle);
  6554.  
  6555.     TEUpdate draws the text specified by hTE within the rectangle
  6556. specified by rUpdate. The rUpdate rectangle must be given in the
  6557. coordinates of the current grafPort. Call TEUpdate every time the
  6558. Tolbox Event Manager function GetNextEvent reports an update event for a
  6559. text editing window--after you call the Window Manager procedure
  6560. BeginUpdate, and before you call EndUpdate.
  6561.  
  6562. Normally you'll do the following when an update event occurs:
  6563.  
  6564.        BeginUpdate(myWindow);
  6565.        EraseRect(myWindow^.portRect);
  6566.        TEUpdate(myWindow^I.protRect,hTE);
  6567.        EndUpdate(myWindow)
  6568.  
  6569.     If you don't include the EraseRect call, the caret may sometimes
  6570. remain visible when the window is deactivated.
  6571. \ TextBox
  6572. 8
  6573. PROCEDURE TextBox (text: Ptr; length: LONGINT; box: Rect; just:
  6574.             INTEGER);
  6575.  
  6576.     TextBox draws the specified text in the rectangle indicated by the
  6577. box parameter with justification just. (See "justification" under "Edit
  6578. Records".)  The text parameter points to the text, and the length
  6579. parameter indicates the number of characters to draw. The rectangle is
  6580. specified in local coordinates, that must be at least as wide as the
  6581. first character drawn (about 20 pixels is usually a good width).
  6582. TextBox does not create an edit record, nor can the text that it draws
  6583. be edited; it's used solely for drawing text. For example:
  6584.  
  6585.     str := 'String in a box';
  6586.     SetRect(r,100,100,200,200);
  6587.     TextBox(POINTER(ORD(@str)+1),LENGTH(str),r,teJustCenter);
  6588.     FrameRect(r)
  6589.  
  6590.     Because Pascal strings start with a length byte, you must advance
  6591. the pointer one position past the beginning of the string to point to
  6592. the start of the text.
  6593. \ TEScroll
  6594. 8
  6595. PROCEDURE TEScroll (dh,dv: INTEGER; hTE: TEHandle);
  6596.  
  6597.     TEScroll scrolls the text within the view rectangle of the specified
  6598. edit record by the number of pixels specified in the dh and dv
  6599. parameters. The edit record is specified by the hTE parameter.
  6600. Positive dh and dv values move the text right and down, respectively,
  6601. and negative values move the text left and up. For example,
  6602.  
  6603.      TEScroll(0,-hTE^^.lineHeight,hTE)
  6604.  
  6605. scrolls the text up one line. Remember that you scroll text up when
  6606. the user clicks in the scroll arrow pointing down. The destination
  6607. rectangle is offset by the amount you scroll.
  6608.  
  6609. (note)
  6610.       To implement automatic scrolling, you store the address
  6611.       of a routine in the clikLoop field of the edit record, as
  6612.       described above under "The TERec Data Type".
  6613. \ TEFromScrap
  6614. 8
  6615. FUNCTION TEFromScrap : OSErr;  [Not in ROM]
  6616.  
  6617.     TEFromScrap copies the desk scrap to the TextEdit scrap.
  6618. \ TEToScrap
  6619. 8
  6620. FUNCTION TEToScrap : OSErr;  [Not in ROM]
  6621.  
  6622.     TEToScrap copies the TextEdit scrap to the desk scrap.
  6623.  
  6624. (warning)
  6625.          You must call the Scrap Manager function ZeroScrap to
  6626.      initialize the desk scrap or clear its previous contents
  6627.      before calling TEToScrap.
  6628. \ TEScrapHandle
  6629. 8
  6630. FUNCTION TEScarapHandle : Handle;  [Not in ROM]
  6631.  
  6632.     TEScrapHandle returns a handle to the TExtEdit scrap.
  6633. \ TEGetScrapLen
  6634. 8
  6635. FUNCTION TEGetScrapLen : LONGINT; [Not in ROM]
  6636.  
  6637.     TEGetScrapLen returns the size of the TextEdit scrap in bytes.
  6638. \ TESetScrapLen
  6639. 8
  6640. PROCEDURE TESetScrapLen (length: LONGINT); [Not in ROM]
  6641.  
  6642.     TESetScrapLen sets the size of the TextEdit scrap to the given
  6643. number of bytes.
  6644. \ TECalText
  6645. 8
  6646. PROCEDURE TECalText (hTE: TEHandle);
  6647.  
  6648.     TECalText recalculates the beginnings of all lines of text in the
  6649. edit record specified by hTE, updating elements of the lineStarts array.
  6650. Call  TECalText if you've changed the destination rectangle, the hText
  6651. field, or any other field that affects the number of characters per line.
  6652.  
  6653. (note)
  6654.       There are two ways to specify text to be edited. The
  6655.       easiest method is to use TESetText, which takes an
  6656.       existing edit record, creates a copy of the specified
  6657.       text, and stores a handle to the copy in the edit record.
  6658.       You can instead directly change the hText field of the
  6659.       edit record, and then call TECalText to recalculate the
  6660.       lineStarts aray to match the new text. If you have a
  6661.       lot of text, you can use the latter method to save space.
  6662. \ TESelView
  6663. 8
  6664. PROCEDURE TESelView (hTE: TEHandle);
  6665.  
  6666.     If automatic scrolling has been enabled (by a call to TEAutoView,
  6667. described below), TESelView makes sure that the selection range is
  6668. visible, scrolling it into the view rectangle if necessary.
  6669. If automatic scrolling is disabled, TESelView does nothing.
  6670.  
  6671. Note:  The top left of the insertion is scrolled into view; if text
  6672. is being displayed in a rectangle that’s not tall enough, automatic
  6673. scrolling could cause the text to jump up and down at times.
  6674. \TEPinScroll
  6675. 8
  6676. PROCEDURE TEPinScroll (dh,dv: INTEGER; hTE: TEHandle);
  6677.  
  6678.     TEPinScroll is similar to TEScroll except that it stops scrolling
  6679. when the last line scrolls into the view rectangle.
  6680. \TEAutoView
  6681. 8
  6682. PROCEDURE TEAutoView (auto: BOOLEAN; hTE: TEHandle);
  6683.  
  6684.     TEAutoView enables and disables automatic scrolling of text in the
  6685. edit record specified by hTe. If the auto parameter is FALSE,
  6686. automatic scrolling is disabled and calling TESelView has no effect.
  6687. \ InitDialogs
  6688. 9
  6689. PROCEDURE InitDialogs (restartProc: ProcPtr);
  6690.  
  6691.     Call InitDialogs once before all other Dialog Manager routines, to
  6692. initialize the Dialog Manager.
  6693.  
  6694.   -It sets a pointer to a fail-safe procedure as specified by
  6695.    restartProc; this pointer will be accessed when a system error
  6696.    (such as running out of memory) occurs. RestartProc should point
  6697.    to a procedure that will restart the application after a system
  6698.    error. If no such procedure is desired, pass NIL as the parameter.
  6699.  
  6700.   -It installs the standard sound procedure.
  6701.  
  6702.   -It passes empty strings to ParamText.
  6703. \ ErrorSound
  6704. 9
  6705. PROCEDURE ErrorSound (soundProc: ProcPtr);
  6706.  
  6707.     ErrorSound sets the sound procedure for dialogs and alerts to the
  6708. procedure pointed to by soundProc; if you don't call ErrorSound, the
  6709. Dialog Manager uses the standard sound procedure. (For details, see
  6710. the "Alerts" section abouve.)  If you pass NIL for soundProc, there will
  6711. be no sound (or menu bar blinking) at all.
  6712. \ SetDAFont
  6713. 9
  6714. PROCEDURE SetDAFont (fontNum: INTEGER);  [Pascal only]
  6715.  
  6716.     For subsequently created dialogs and alerts, SetDAFont sets the font
  6717. of the dialog or alert window's grafPort to the font having the
  6718. specified font number. If you don't call this procedure, the system
  6719. font is used. SetDAFont affects statText and editText items but not
  6720. titles of controls, which are always in the system font.
  6721. \ NewDialog
  6722. 9
  6723. FUNCTION NewDialog (dStorage: Ptr; boundsRect: Rect; title: Str255;
  6724.             visible: BOOLEAN; procID: INTEGER; behind: WindowPtr;
  6725.         goAwayFlag: BOOLEAN; refCon: LongInt; items: Handle) :
  6726.         DialogPtr;
  6727.  
  6728.     NewDialog creates a dialog as specified by its parameters and
  6729. returns a pointer to the new dialog. The first eight parameters
  6730. (dStorage through refCon) are pased to the Window Manager function
  6731. NewWindow, which creates the dialog window; the meanings of these
  6732. parameters are summarized below. The items parameter is a handle to the
  6733. dialog's item list. You can get the items handle by calling the
  6734. Resource Mangager to read the item list from the resource file into
  6735. memory.
  6736.  
  6737. (note)
  6738.       Advanced programmers can create their own item lists in
  6739.       memory rather than have them read from a resource file.
  6740.       The exact format is given later under "Formats of
  6741.       Resources for Dialogs and Alerts".
  6742.  
  6743.     DStorage is analogous to the wStorage parameter of NewWindow; it's a
  6744. pointer to the storage to use for the dialog record. If you pass NIL
  6745. for dStorage, the dialog record will be allocated on the heap (which,
  6746. in the case of modeless dialogs, may cause the heap to become
  6747. fragmented).
  6748.  
  6749.     BoundsRect, a rectangle given in global coordinates, determines the
  6750. dialog window's size and location. It becomes the portRect of the
  6751. window's grafPort. Remember that the top coordinate of this rectangle
  6752. should be at least 25 points below the top of the screen for a modal
  6753. dialog, to allow for the menu bar and the border around the portRect,
  6754. and at least 40 points below the top of the screen for a modeless
  6755. dialog, to allow for the menu bar and the window's title bar.
  6756.  
  6757.     Title is the title of a modeless dialog box; pass the empty string
  6758. for modal dialogs.
  6759.  
  6760.     If the visible parameter is TRUE, the dialog window is drawn on the
  6761. screen. If it's FALSE, the window is initially invisible and may later
  6762. be shown with a call to the Window Manager procedure ShowWindow.
  6763.  
  6764. (note)
  6765.       NewDialog generates an update event for the entire window
  6766.       contents, so the items aren't drawn immediately, with the
  6767.       exception of controls. The Dialog Manager calls the
  6768.       Control Manager to draw controls, and the Control Manager
  6769.       draws them immediately rather than via the standard
  6770.       update mechanism. Because of this, the Dialog Manager
  6771.       calls the Window Manager procedure ValidRect for the
  6772.       enclosing rectangle of each control, so the controls
  6773.       won't be drawn twice. If you find that the other items
  6774.       aren't being drawn soon enough after the controls, try 
  6775.       making the window invisible initially and then calling
  6776.       ShowWindow to show it.
  6777.  
  6778.     ProcID is the window definition ID, which leads to the window
  6779. definition function for this type of window. The window definition IDs
  6780. for the standard types of dialog window are dBoxProc for the modal type
  6781. and documentProc for the modeless type.
  6782.  
  6783.     The behind parameter specifies the window behind which the dialog
  6784. window is to be placed on the desktop. Pass POINTER(-1) to bring up
  6785. the dialog window in front of all other windows.
  6786.  
  6787.     GoAwayFlag applies to modeles dialog boxes; if it's TRUE, the dialog
  6788. window has a close box in its title bar when the window is active.
  6789.  
  6790.     RefCon is the dialog window's reference value, which the application
  6791. may store into and access for any purpose.
  6792.  
  6793.     NewDialog sets the font of the dialog window's grafPort to the
  6794. system font or, if you previously called SetDAFont, to the specified
  6795. font. It also sets the window class in the window record to dialogKind.
  6796. \ GetNewDialog
  6797. 9
  6798. FUNCTION GetNewDialog (dialogID: INTEGER; dStorage: Ptr; behind:
  6799.             WindowPtr) : DialogPtr;
  6800.  
  6801.     Like NewDialog (above), GetNewDialog creates a dialog as specified
  6802. by its parameters and returns a pointer to the new dialog. Instead of
  6803. having the parameters boundsRect, title, visible, procID, goAwayFlag,
  6804. and refCon, GetNewDialog has a single dialogID parameter, where
  6805. dialogID is the resource ID of a dialog template that supplies the same
  6806. information as those parameters. The dialog template also contains the
  6807. resource ID of the dialog's item list. After calling the Resource
  6808. Manager to read the item list into memory (if it's not already in
  6809. memory), GetNewDialog makes a copy of the item list and uses that copy;
  6810. thus you may have multiple independent dialogs whose items have the
  6811. same types, locations, and initial contents. The dStorage and behind
  6812. parameters of GetNewDialog have the same meaning as in NewDialog.
  6813. \ CloseDialog
  6814. 9
  6815. PROCEDURE CloseDialog (theDialog: DialogPtr);
  6816.  
  6817.     CloseDialog removes theDialog's window from the screen and deletes
  6818. it from the window list, just as when the Window Manager procedure
  6819. CloseWindow is called. It releases the memory occupied by the
  6820. following:
  6821.  
  6822.   -The data structures associated with the dialog window (such as the
  6823.    window's structure, content, and update regions).
  6824.  
  6825.   -All the items in the dialog (except for pictures and icons, which
  6826.    might be shared resources), and any data structures associated
  6827.    with them. For example, it would dispose of the region occupied
  6828.    by the thumb of a scroll bar, or a similar region for some other
  6829.    control in the dialog.
  6830.  
  6831.     CloseDialog does not dispose of the dialog record or the item list.
  6832. Figure 6 illustrates the effect of CloseDialog (and DisposDialog,
  6833. described below).
  6834.  
  6835.     Call CloseDialog when you're done with a dialog if you supplied
  6836. NewDialog or GetNewDialog with a pointer to the dialog storage (in the
  6837. dStorage parameter) when you created the dialog.
  6838.  
  6839. (note)
  6840.       Even if you didn't supply a pointer to the dialog
  6841.       storage, you may want to call CloseDialog if you created
  6842.       the dialog with NewDialog. You would call CloseDialog if
  6843.       you wanted to keep the item list around (since, unlike
  6844.       GetNewDialog, NewDialog does not use a copy of the item
  6845.       list).
  6846. \ DisposDialog
  6847. 9
  6848. PROCEDURE DisposDialog (theDialog: DialogPtr);
  6849.  
  6850.     DisposDialog calls CloseDialog (above) and then releases the memory
  6851. occupied by the dialog's item list and dialog record. Call
  6852. DisposDialog when you're done with a dialog if you let the dialog
  6853. record be allocated on the heap when you created the dialog (by passing
  6854. NIL as the dStorage parameter to NewDialog or GetNewDialog).
  6855. \ CouldDialog
  6856. 9
  6857. PROCEDURE CouldDialog (dialogID:  INTEGER);
  6858.  
  6859.     CouldDialog ensures that the dialog template having the given
  6860. resource ID is in memory and makes it unable to be purged. It does the
  6861. same for the dialog window's definition function, the dialog's item list
  6862. resource, and any item defined as resources. This is useful if the
  6863. dialog box may come up when the resource file isn't accessible, such as
  6864. during a disk copy.
  6865. \ FreeDialog
  6866. 9
  6867. PROCEDURE FreeDialog (dialogID: INTEGER);
  6868.  
  6869.     Given the resource ID of a dialog template previously specified in a
  6870. call to CouldDialog (above), FreeDialog undoes the effect of
  6871. CouldDialog. It should be called when there's no longer a need to keep
  6872. the resources in memory.
  6873. \ ModalDialog
  6874. 9
  6875. PROCEDURE ModalDialog (filterProc: ProcPtr; VAR itemHit: INTEGER);
  6876.  
  6877.     Call ModalDialog after creating a modal dialog and bringing up its
  6878. window in the frontmost plane. ModalDialog repeatedly gets and handles
  6879. events in the dialog's window; after handling an event involving an
  6880. enabled dialog item, it returns with the item number in itemHit.
  6881. Normally you'll then do whatever is appropriate as a response to an 
  6882. event in that item.
  6883.  
  6884.     ModalDialog gets each event by calling the Toolbox Event Manager
  6885. function GetNextEvent. If the event is a mouse-down event outside the
  6886. content region of the dialog window, ModalDialog emits sound number 1
  6887. (which should be a single beep) and gets the next event; otherwise, it
  6888. filters and handles the event as described below.
  6889.  
  6890. (note)
  6891.       Once before getting each event, ModalDialog calls
  6892.       SystemTask, a Desk Manager procedure that needs to be
  6893.       called regularly if the application is to support the use
  6894.       of desk accessories.
  6895.  
  6896.     The filterProc parameter determines how events are filtered. If it's
  6897.  NIL, the standard filterProc function is executed; this causes
  6898.  ModalDialog to return 1 in itemHit if the Return key or Enter key is
  6899.  pressed. If filterProc isn't NIL, ModalDialog filters events by
  6900.  executing the function it points to. Your filterProc function should
  6901.  have three parameters and return a Boolean value. For example, this is
  6902.  how it would be declared if it were named MyFilter:
  6903.  
  6904.       FUNCTION MyFilter (theDialog: DialogPtr; VAR theEvent:
  6905.                          EventRecord; VAR itemHit: INTEGER ) : BOOLEAN;
  6906.  
  6907.     A function result of FALSE tells ModalDialog to go ahead and handle
  6908. the event, which either can be sent through unchanged or can be changed
  6909. to simulate a different event. A function result of TRUE tells
  6910. ModalDialog to return imediately rather than handle the event; in this
  6911. case, the filterProc function sets itemHit to the item number that
  6912. ModalDialog should return.
  6913.  
  6914. (note)
  6915.       ModalDialog calls GetNextEvent with a mask that excludes
  6916.       disk-inserted events. To receive disk-inserted events,
  6917.       your filterProc function can call GetNextEvent (or
  6918.       EventAvail) with a mask that accepts only that type of event.
  6919.  
  6920.     ModalDialog handles the evnets for which the filterProc function
  6921. returns FALSE as follows:
  6922.  
  6923.   -In response to an activate or update event for the dialog window,
  6924.    ModalDialog activates or updates the window.
  6925.  
  6926.   -If the mouse button is pressed in an editText item, ModalDialog
  6927.    responds to the mouse activity as appropriate (displaying an
  6928.    insertion point or selecting text). If a key-down event occurs
  6929.    and there's an editText item, text entry and editing are handled
  6930.    in the standard way for such items (except that if the Command key
  6931.    is down, ModalDialog responds as though it isn't). In either
  6932.    case, ModalDialog returns if the editText item is enabled or does
  6933.    nothing if it's disabled. If a key-down event occurs when there's
  6934.    no editText item, ModalDialog does nothing.
  6935.  
  6936.   -If the mouse button is pressed in a control, ModalDialog calls the
  6937.    Control Manager function TrackControl. If the mouse button is
  6938.    released inside the control and the control is enabled,
  6939.    ModalDialog returns; otherwise, it does nothing.
  6940.  
  6941.   -If the mouse button is pressed in any other enabled item in the
  6942.    dialog box, ModalDialog returns. If the mouse button is pressed
  6943.    in any other disabled item or in no item, or if any other event
  6944.    occurs, ModalDialog does nothing.
  6945. \ IsDialogEvent
  6946. 9
  6947. FUNCTION IsDialogEvent (theEvent: EventRecord) : BOOLEAN;
  6948.  
  6949.     If your application includes any modeless dialogs, call
  6950. IsDialogEvent after calling the Toolbox Event Manager function
  6951. GetNextEvent. Pass the current event in theEvent. IsDialogEvent
  6952. determines whether theEvent needs to be handled as part of a dialog. If
  6953. theEvent is an activate or update event for a dialog window, a
  6954. mouse-down event in the content region of an active dialog window, or
  6955. any other type of event when a dialog window is active, IsDialogEvent
  6956. returns TRUE; otherwise, it returns FALSE.
  6957.  
  6958.     When FALSE is returned, just handle the event yourself like any
  6959. other event that's not dialog-related. When TRUE is returned, you'll
  6960. generally end up passing the event to DialogSelect for it to handle (as
  6961. described below), but first you should do some additional checking:
  6962.  
  6963.    - DialogSelect doesn't handle keyboard equivalents for commands.
  6964.      Check whether the event is a key-down event with the Command key
  6965.      held down and, if so, carry out the command if it's one that
  6966.      applies when a dialog window is active. (If the command doesn't
  6967.      so apply, do nothing.)
  6968.  
  6969.   - In special cases, you may want to bypass DialogSelect or do some
  6970.     preprocessing before calling it. If so, check for those events
  6971.     and respond accordingly. You would need to do this, for example,
  6972.     if the dialog is to respond to disk-inserted events.
  6973.  
  6974.     For cases other than these, pass the event to DialogSelect for it to
  6975. handle.
  6976. \ DialogSelect
  6977. 9
  6978. FUNCTION DialogSelect (theEvent: EventRecord; VAR theDialog: DialogPtr;
  6979.             VAR itemHit: INTEGER) : BOOLEAN;
  6980.  
  6981.     You'll normally call DialogSelect after IsDialogEvent, passing in
  6982. theEvent an event that needs to be handled as part of a modeless
  6983. dialog. DialogSelect handles the event as described below. If the
  6984. event involves an enabled dialog item, DialogSelect returns a function
  6985. result of TRUE with the dialog pointer in theDialog and the item number
  6986. in itemHit; otherwise, it returns FALSE with theeDialog and itemHit
  6987. undefined. Normally when DialogSelect returns TRUE, you'll do whatever
  6988. is appropriate as a response to the event, and when it returns FALSE
  6989. you'll do nothing.
  6990.  
  6991.     If the event is an activate or update event for a dialog window,
  6992. DialogSelect activates or updates the window ane returns FALSE.
  6993.  
  6994.     If the event is a mouse-down event in an editText item, DialogSelect
  6995. responds as appropriate (displaying an insertion point or selecting
  6996. text). If it's a key-down event and there's an editText item, text
  6997. entry and editing are handled in the standard way. In either case,
  6998. DialogSelect returns TRUE if the editText item is enabled or FALSE if
  6999. it's disabled. If a key-down event is passed when there's no editText
  7000. item, DialogSelect returns FALSE.
  7001.  
  7002. (note)
  7003.       For a key-down event, DialogSelect doesn't check to see
  7004.       whether the Command key is held down; to handle keyboard
  7005.       equivalents of commands, you have to check for them
  7006.       before calling DialogSelect. Similarly, to treat a typed
  7007.       character in a special way (such as ignore it, or make it
  7008.       have the same effect as another character or as clicking
  7009.       a button), you need to check for a key-down event with
  7010.       that character before calling DialogSelect.
  7011.  
  7012.     If the event is a mouse-down event in a control, DialogSelect calls
  7013. the Control Manager function TrackControl. If the mouse button is
  7014. released inside the control and the control is enabled, DialogSelect
  7015. returns TRUE; otherwise, it returns FALSE.
  7016.  
  7017.     If the event is a mouse-down event in any other enabled item,
  7018. DialogSelect returns TRUE. If it's  a mouse-down event in any other
  7019. disabled item or in no item, or if it's any other event, DialogSelect
  7020. returns FALSE.
  7021. \ DlgCut
  7022. 9
  7023. PROCEDURE DlgCut (theDialog: DialogPtr);   [Pascal only]
  7024.  
  7025.     DlgCut checks whether theDialog has any editText items and, if so,
  7026. applies the textEdit procedure TECut to the currently selected editText
  7027. item. (If the dialog record's editField is 0 or greater, DlgCut passes
  7028. the contents of the textH field to TECut.)  You can call DlgCut to
  7029. handle the editing command Cut when a modeless dialog window is active.
  7030. \ DlgCopy
  7031. 9
  7032. PROCEDURE DlgCopy (theDialog: DialogPtr);   [Pascal only]
  7033.  
  7034.     DlgCopy is the same as DlgCut (above) except that it calls TECopy,
  7035. for handling the Copy command.
  7036. \ DlgPaste
  7037. 9
  7038. PROCEDURE DlgPaste (theDialog: DialogPtr);   [Pascal only]
  7039.  
  7040.     DlgPaste is the same as DlgCut (above) except that it calls TEPaste,
  7041. for handling the Paste command.
  7042. \ DlgDelete
  7043. 9
  7044. PROCEDURE DlgDelete (theDialog: DialogPtr);   [Pascal only]
  7045.  
  7046.     DlgDelete is the same as DlgCut (above) except that it calls
  7047. TEDelete, for handling the Clear command.
  7048. \ DrawDialog
  7049. 9
  7050. PROCEDURE DrawDialog (theDialog: DialogPtr);
  7051.  
  7052.     DrawDialog draws the contents of the given dialog box. Since
  7053. DialogSelect and ModallDialog handle dialog window updating, this
  7054. procedure is useful only in unusual situations. You would call it, for
  7055. example, to display a dialog box that doesn't require any response but
  7056. merely tells the user what's going on during a time-consuming process.
  7057. \ Alert
  7058. 9
  7059. FUNCTION Alert (alertID: INTEGER; filterProc: ProcPtr) : INTEGER;
  7060.  
  7061.     This function invokes the alert defined by the alert template that
  7062. has the given resource ID. It calls the currnet sound procedure, if
  7063. any,l passing it the sound number specified in the alert template for
  7064. this stage of the alert. If no alert box is to be drawn at this stage,
  7065. Alert returns a function result of -1; otherwise, it creates and
  7066. displays the alert window for this alert and draws the alert box.
  7067.  
  7068. (note)
  7069.       It creates the alert window by calling NewDialog, and
  7070.       does the rest of its processing by calling ModalDialog.
  7071.  
  7072.     Alert repeatedly gets and handles events in the alert window until
  7073. an enabled item is clicked, at which time it returns the item number.
  7074. Normally you'll then do whatever is appropriate in response to a click
  7075. of that item.
  7076.  
  7077.     Alert gets each event by calling theToolbox Event Manager function
  7078. GetNextEvent. If the event is a mouse-down event outside the content
  7079. region of the alert window, Alert emits sound number 1 (which should be
  7080. a single beep) and gets the next event; otherwise, it filters and
  7081. handles the event as describe below.
  7082.  
  7083.     The filterProc parameter has the same meaning as in ModalDialog (see
  7084. above). If it's NIL, the standard filterProc function is executed,
  7085. which makes the Return key or the Enter key have the same effect as
  7086. clicking the default button. If you specify your own filterProc
  7087. function and want to retain this feature, you must include it in your
  7088. function. You can find out what the current default button is by
  7089. looking at the aDefItem field of the dialog record for the alert (via
  7090. the dialog pointer passed to the function).
  7091.  
  7092.     Alert handles the events for which the filterProc function returns
  7093. FALSE as follows:
  7094.  
  7095.  
  7096.   - If the mouse button is pressed in a control, Alert calls the
  7097.     Control Manager procedure TrackControl. If the mouse buton is
  7098.     released inside the control and the control is enabled, Alert
  7099.     returns; otherwise, it does nothing.
  7100.  
  7101.   - If the mouse button is pressed in any other enabled item, Alert
  7102.     simply returns. If it's pressed in any other disabled item or in 
  7103.     no item, or if any other event occurs, Alert does nothing.
  7104.  
  7105.     Before returning to the application with the item number, Alert
  7106. removes the alert box from the screen. (It disposes of the alert window
  7107. and its associated data structures, the item list, and the items.)
  7108.  
  7109. (note)
  7110.        The Alert function's removal of the alert box would not
  7111.        be the desired result if the user clicked a check box or
  7112.        radio button; however, normally alerts contain only
  7113.        static text, icons, pictures, and buttons that are
  7114.        supposed to make the alert box go away. If your alert
  7115.        contains other items besides these, consider whether it
  7116.        might be more appropriate as a dialog.
  7117. \ StopAlert
  7118. 9
  7119. FUNCTION StopAlert (alertID: INTEGER; filterProc: ProcPtr) : INTEGER;
  7120.  
  7121.     StopAlert is the same as the Alert function (above) except that
  7122. before drawing the items of the alert in the alert box, it draws the
  7123. Stop icon in the top left corner of the box (within the rectangle
  7124. (10,20,42,52)). The Stop icon has the following resource ID:
  7125.  
  7126.        CONST stopIcon = 0;
  7127.  
  7128.     If the application's resource file doesn't include an icon with that
  7129. ID number, the Dialog Manager uses the standart Stop icon in the system
  7130. resource file (see Figure 7).
  7131. \ NoteAlert
  7132. 9
  7133. FUNCTION NoteAlert (alertID: INTEGER; filterProcf: ProcPtr) : INTEGER;
  7134.  
  7135.     NoteAlert is like StopAlert except that it draws the Note icon,
  7136. which has the following resource ID:
  7137.  
  7138.        CONST noteIcon = 1;
  7139. \ CautionAlert
  7140. 9
  7141. FUNCTION CautionAlert (alertID: INTEGER; filterProc: ProcPtr) :
  7142.            INTEGER;
  7143.  
  7144.     CautionAlert is like StopAlert except that it draws the Caution
  7145. icon, which has the following resource ID:
  7146.  
  7147.        CONST ctnIcon = 2;
  7148. \ CouldAlert
  7149. 9
  7150. PROCEDURE CouldAlert (alertID: INTEGER);
  7151.  
  7152.     CouldAlert ensures that the alert template having the given resource
  7153. ID is in memory and makes it unable to be purged. It does the same for
  7154. the alert window's definition function, the alert's item list resource,
  7155. and any items defined as resources. This is useful if the alert may
  7156. occur when the resource file isn't accessible, such as during a disk
  7157. copy.
  7158. \ FreeAlert
  7159. 9
  7160. PROCEDURE FreeAlert (alertID: INTEGER);
  7161.  
  7162.     Given the resource ID of an alert template previously specified in a
  7163. call to CouldAlert (above), FreeAlert undoes the effect of CouldAlert.
  7164. It should be called when there's no longer a need to keep the resources
  7165. in memory.
  7166. \ ParamText
  7167. 9
  7168. PROCEDURE ParamText (param0,param1,param2,param3: Str255);
  7169.  
  7170.     ParamText provides a means of substituting text in statText items:
  7171. param0 through param3 will replace the special strings '^0' through
  7172. '^I3' in all statText items in all subsequent dialog or alert boxes.
  7173. Pass empty strings for parameters not used.
  7174.  
  7175.     For example, if the text is defined as 'Cannot open document ^0' and
  7176. docName is a string variable containg a document name that the user
  7177. typed, you can call ParamText(docName, '','','').
  7178.  
  7179. (warning)
  7180.          All strings that will need to be translated to foreign
  7181.         languages should be stored in resource files.
  7182.  
  7183.  
  7184.  
  7185. \ GetDItem
  7186. 9
  7187. PROCEDURE GetDItem (theDialog: DialogPtr; itemNo: INTEGER; VAR type:
  7188.                     INTEGER; VAR item: Handle; VAR box: Rect);
  7189.  
  7190.     GetDItem returns in its VAR parameters the following information
  7191. about the item numbered itemNo in the given dialog's item list: in the
  7192. type parameter, the item type; in the item parameter, a handle to the
  7193. item (or, for item type userItem, the procedure pointer); and in the box
  7194. parameter, the display rectangle for the item.
  7195.  
  7196.     Suppose, for example, that you want to change the title of a control
  7197. in a dialog box. You can get the item handle with GetDItem, convert it
  7198. to type ControlHandle, and call the Control Manager procedure SetCTitle
  7199. to change the title. Similarly, to move the control or change its size,
  7200. you would call MoveControl or SizeControl.
  7201.  
  7202. (note)
  7203.       To access the text of a statText or editText item, pass
  7204.       the handle returned by GetDItem to GetIText or SetIText
  7205.       (see below).
  7206. \ SetDItem
  7207. 9
  7208. PROCEDURE SetDItem (theDialog: DialogPtr; itemNo: INTEGER; type:
  7209.             INTEGER; item: Handle; box: rect);
  7210.  
  7211.     SetDItem sets the item numbered itemNo in the given dialog's item
  7212. list, as specified by the parameters (without drawing the item). The
  7213. type parameter is the item type; the item parameter is a handle to the
  7214. item (or, for item type userItem, the procedure pointer); and the box
  7215. parameter is the display rectangle for the item.
  7216.  
  7217.     Consider, for example, how to install an item of type userItem in a
  7218. dialog:  In the item list in the resource file, define an item in which
  7219. the type is set to userItem and the display rectangle to (0,0,0,0).
  7220. Specify that the dialog window be invisible (in either the dialog
  7221. template or the NewDialog call). After creating the dialog, convert
  7222. the item's procedure pointer to type Handle; then call SetDItem,
  7223. passing that handle and the display rectangle for the item. Finally,
  7224. call the Window Manager procedure ShowWindow to display the dialog
  7225. window.
  7226.  
  7227. (note)
  7228.       Do not use SetDItem to change the text of a statText or
  7229.       editText item or to change or move a control. See the
  7230.       description of GetDItem above for more information.
  7231. \ GetIText
  7232. 9
  7233. PROCEDURE GetIText (item: Handle; VAR text: str255);
  7234.  
  7235.     Given a handle to a statText or editText item in a dialog box, as
  7236. returned by GetDItem, GetIText returns the text of the item in the text
  7237. parameter.
  7238. \ SetIText
  7239. 9
  7240. PROCEDURE SetIText (item: Handle; text: Str255);
  7241.  
  7242.     Given a handle to a statText or editText item in a dialog box, as
  7243. returned by GetDItem, SetIText sets the text of the item to the
  7244. specified text and draws the item. For example, suppose the exact
  7245. content of a dialog's text item cannot be determined until the
  7246. application is running, but the display rectangle is defined in the
  7247. resource file:  Call GetDItem to get a handle to the item, and call
  7248. SetIText with the desired text.
  7249. \ SelIText
  7250. 9
  7251. PROCEDURE SelIText (theDialog: DIalogPtr; itemNo: INTEGER;
  7252.            strtSel,endSel: INTEGER);
  7253.  
  7254.     Given a pointer to a dialog and the item number of an editText item
  7255. in the dialog box, SelIText does the following:
  7256.  
  7257.    - If the item contains text, SelIText sets the selection range to
  7258.      extend from character position strtSel up to but not including
  7259.      character position endSel. The selection range is inverted unless
  7260.      strtSel equals endSel, in which case a blinking vertical bar is
  7261.      displayed to indicate an insertion point at that position.
  7262.  
  7263.    - If the item doesn't contain text, SelIText simply displays the
  7264.      insertion point.
  7265.  
  7266.     For example, if the user makes an unacceptable entry in the editText
  7267. item, the application can put up an alert box reporting the problem and
  7268. then select the entire text of the item so it can be replaced by a new
  7269. entry. (Without this procedure, the user would have to select the item
  7270. before making the new entry.)
  7271.  
  7272. (note)
  7273.       You can select the entire text by specifying 0 for
  7274.       strtSel and a very large number for endSel. For details
  7275.       about selection range and character position, see the
  7276.       TextEdit manual.
  7277. \ GetAlrtStage
  7278. 9
  7279. FUNCTION GetAlrtStage : INTEGER;   [Pascal only]
  7280.  
  7281.     GetAlrtStage returns the stage of the last occurrence of an alert,
  7282. as a number from 0 to 3.
  7283. 9
  7284. PROCEDURE ResetAlrtStage;   [Pascal only]
  7285.  
  7286.     ResetAlrtStage resets the stage of the last occurrence of an alert
  7287. so that the next occurrenct of the same alert will be treatd as its
  7288. first stage. This is useful, for example, when you've used ParamText
  7289. to change the text of an alert such that from the user's point of view
  7290. it's a different alert.
  7291. \ HideDItem
  7292. 9
  7293. PROCEDURE HideDItem (theDialog: DialogPtr; itemNo: INTEGER);
  7294.  
  7295.     HideDItem hides the item numbered itemNo in the given dialog’s item
  7296. list by giving the item a display rectangle that’s off the screen.
  7297. (Specifically, if the left coordinate of the item’s display rectangle
  7298. is less than 8192, ShowDItem adds 16384 to both the left and right
  7299. coordinates the rectangle.)  If the item is already hidden (that is,
  7300. if the left coordinate is greater than 8192), HideDItem does nothing.
  7301.  
  7302.     HideDItem calls the EraseRect procedure on the item’s enclosing
  7303. rectangle and adds the rectangle that contained the item (not
  7304. necessarily the item’s display rectangle) to the update region.
  7305. If the specified item is an active editText item, the item is first
  7306. deactivated (by calling TEDeactivate).
  7307.  
  7308. Note:  If you have items that are close to each other, be aware that
  7309.        the Dialog Manager draws outside of the enclosing rectangle by 3
  7310.        pixels for editText items and by 4 pixels for a default button.
  7311.  
  7312.     An item that’s been hidden by HideDItem can be redisplayed by the
  7313. ShowDItem procedure.
  7314.  
  7315. Note:  To create a hidden item in a dialog item list, simply add
  7316.        16384 to the left and right coordinates of the display rectangle.
  7317. \ ShowDItem
  7318. 9
  7319. PROCEDURE ShowDItem (theDialog: DialogPtr; itemNo: INTEGER);
  7320.  
  7321.     ShowDItem redisplays the item numbered itemNo, previously hidden by
  7322. HideDItem, by giving the item the display rectangle it had prior to
  7323. the HideDItem call. (Specifically, if the left coordinate of the
  7324. item’s display rectangle is greater than 8192, ShowDItem subtracts
  7325. 16384 from both the left and right coordinates the rectangle.)
  7326. If the item is already visible (that is, if the left coordinate is
  7327. less than 8192), ShowDItem does nothing.
  7328.  
  7329.     ShowDItem adds the rectangle that contained the item (not
  7330. necessarily the item’s display rectangle) to the update region so
  7331. that it will be drawn. If the item becomes the only editText item,
  7332. ShowDItem activates it (by calling TEActivate).
  7333. \FindDItem
  7334. 9
  7335. FUNCTION FindDItem (theDialog: DialogPtr; thePt: Point) : INTEGER;
  7336.  
  7337.     FindDItem returns the item number of the item containing the point
  7338. specified, in local coordinates, by thePt. If the point doesn’t lie
  7339. within the item’s rectangle, FindDItem returns –1.  If there are
  7340. overlapping items, it returns the item number of the first item in
  7341. the list containing the point. FindDItem is useful for changing the
  7342. cursor when it’s over a particular item.
  7343.  
  7344. Note:  FindDItem will return the item number of disabled items as well.
  7345. \UpdtDialog
  7346. 9
  7347. PROCEDURE UpdtDialog (theDialog: DialogPtr; updateRgn: RgnHandle);
  7348.  
  7349.     UpdtDialog is a faster version of the DrawDialog procedure.
  7350. Instead of drawing the entire contents of the given dialog box,
  7351. UpdtDialog draws only the items that are in a specified update region.
  7352. UpdtDialog is called in response to an update event, and is usually
  7353. bracketed by calls to the Window Manager procedures BeginUpdate and
  7354. EndUpdate. UpdateRgn should be set to the visRgn of theWindow’s port.
  7355. (For more details, see the BeginUpdate procedure in chapter 9 of
  7356. Volume I.)
  7357. \ OpenDeskAcc
  7358. 10
  7359. FUNCTION OpenDeskAcc (theAcc: Str255) : INTEGER;
  7360.  
  7361.     OpenDeskAcc opens the desk accessory having the given name and
  7362. displays its window (if any) as the active window. The name is the
  7363. accessory's resource name, which you get from the Apple menu by calling
  7364. the Menu Manager procedure GetItem. OpenDeskAcc calls the Resource
  7365. Manager to read the desk accessory from the resource file.
  7366.  
  7367.     You should ignore the value returned by OpenDeskAcc. If the desk
  7368. accessory is successfully opened, the function result is its driver
  7369. reference number; as described under CloseDeskAcc below, you don't need
  7370. this number to close the accessory. If the desk accessory can't be
  7371. opened, the function result is undefined; the accessory will have taken
  7372. care of informing the user of the problem (such as memory full) and not
  7373. displaying itself.
  7374.  
  7375. (warning)
  7376.          It may occasionally happen that the current grafPort will
  7377.          be the desk accessory's port upon return from
  7378.          OpenDeskAcc. To be safe, you should bracket your call to
  7379.          OpenDeskAcc with calls to the QuickDraw procedures
  7380.          GetPort and SetPort, to save and restore the current
  7381.          port.
  7382.  
  7383.     Before you open a desk accessory it's a good idea to determine
  7384. whether there's enough memory available. Here's an example of how to do
  7385. that:
  7386.  
  7387.         SetResLoad(FALSE);
  7388.         myResHandle := GetNamedResource('DRVR', theAcc);
  7389.         size := SizeResource(myResHandle);
  7390.         myHandle := NewHanddle(size + 3072);
  7391.         IF myHandle = NIL
  7392.           THEN {put up an alert indicating there's not enough memory}
  7393.           ELSE OpenDeskAcc(theAcc)
  7394.  
  7395.     The extra 3K bytes in the argument to the Memory Manager's NewHandle
  7396. function is an average amount of heap space used by desk accessories
  7397. while they're running.
  7398. \ CloseDeskAcc
  7399. 10
  7400. PROCEDURE CloseDeskAcc (refNum: INTEGER);
  7401.  
  7402.     When a system window is active and the user choses Close from the
  7403. File menu, call CloseDeskAcc to close the desk accessory. RefNum is the
  7404. driver reference number for the desk accessory, which you get from the
  7405. windowKind field of its window.
  7406.  
  7407.     The Desk Manager automatically closes a desk accessory if the user
  7408. clicks its close box. Also, since the application heap is released
  7409. when the application terminates, every desk accessory goes away at that
  7410. time.
  7411. \ SystemClick
  7412. 10
  7413. PROCEDURE SystemClick (theEvent: EventRecord; theWindow: WindowPtr);
  7414.  
  7415.     When a mouse-down event occurs and the Window Manager function
  7416. FindWindow reports that the mouse button was pressed in a system
  7417. window, the application should call SystemClick with the event record
  7418. and the window pointer. If the given window belongs to a desk
  7419. accessory, SystemClick sees that the event gets handled properly.
  7420.  
  7421.     SystemClick determines which part of the desk accessory's window the
  7422. mouse button was pressed in, and responds accordingly (similar to the
  7423. way your application responds to mouse activities in its own windows).
  7424.  
  7425.   - If the mouse button was pressed in the content region and the
  7426.     window and the window was active, SystemClick sends the mouse-down
  7427.     event to the desk accessory, which proceses it as appropriate.
  7428.  
  7429.   - If the mouse button was pressed in the content region and the
  7430.     window was inactive, SystemClick makes it the active window.
  7431.  
  7432.   - If the mouse button was pressed in the drag region, SystemClick
  7433.     calls the Window Manager procedure DragWindow to pull an outline
  7434.     of the window across the screen and move the window to a new
  7435.     location. If the window was inactive, DragWindow also makes it
  7436.     the active window (unless the Command key was pressed along with
  7437.     the mouse button).
  7438.  
  7439.   - If the mouse button was pressed in the go-away region, SystemClick
  7440.     calls the Window Manager function TrackGoAway to determine whether
  7441.     the mouse is still inside the go-away region when the click is
  7442.     completed:  if so, it tells the desk accessory to close itself
  7443.     otherwise, it does nothing.
  7444. \ SystemEdit
  7445. 10
  7446. FUNCTION SystemEdit (editCmd: INTEGER) : BOOLEAN;
  7447.  
  7448.     Call SystemEdit when there's a mouse-down event in the menu bar and
  7449. the user choses one of the five standard editing commands from the Edit
  7450. menu. Pass one of the following as the value of the editCmd parameter:
  7451.  
  7452.        EditCmd          Editing command
  7453.        0                Undo
  7454.        2                Cut
  7455.        3                Copy
  7456.        4                Paste
  7457.        5                Clear
  7458.  
  7459.  
  7460.     If your Edit menu contains these five commands in the standard
  7461. arrangement (the order listed above, with a gray line separating Undo
  7462. and Cut), you can simply call
  7463.  
  7464.      SystemEdit(menuItem - 1)
  7465.  
  7466.     If the active window dewsn't belong to a desk accessory, SystemEdit
  7467. returns FALSE; the application should then process the editing comand
  7468. as usual. If the active window dews belong to a desk accessory,
  7469. SystemEdit asks that accessory to process the command and returns TRUE;
  7470. in this case, the application should ignore the command.
  7471.  
  7472. (note)
  7473.       It's up to the application to make sure desk accessories 
  7474.       get their editing comands that are chosen from the Edit
  7475.       menu. In particular, make sure your application hasn't
  7476.       disabled the Edit menu or any of the five standard
  7477.       commands when a desk accessory is activated.
  7478. \ SystemTask
  7479. 10
  7480. PROCEDURE SystemTask;
  7481.  
  7482.     For each open desk accessory, SystemTask causes the accessory to
  7483. perform the periodic action defined for it, if any such action has been
  7484. defined and if the proper time period has passed since the action was
  7485. last performed. For example, a clock accessory can be deifined such
  7486. that the second hand is to move once every second; the periodic action
  7487. for the accessory will be to move the second hand to the next position,
  7488. and SystemTask will alert the accessory every second to perform that
  7489. action.
  7490.  
  7491.     You should call SystemTask as often as possible, usually once every
  7492. time through your main event loop. Call it more than once if your
  7493. applicaition dies an unusually large amount of processing each time
  7494. through the loopk.
  7495.  
  7496. (note)
  7497.       SystemTask should be called at least every sixtieth of a
  7498.       second.
  7499.  
  7500.  
  7501.  
  7502. \ SystemEvent
  7503. 10
  7504. FUNCTION SystemEvent (theEvent: EventRecord) : BOOLEAN;
  7505.  
  7506.     SystemEvent is called only by the Toolbox Event Manager function
  7507. GetNextEvent when it receives an event, to determine whether the event
  7508. should be handled by the application or by the system. If the given
  7509. event should be handled by the application, SystemEvent returns FALSE;
  7510. otherwise, it calls the appropriate system code to handle the event and
  7511. returns TRUE.
  7512.  
  7513.     In the case of a null, abort, or mouse-down event, SystemEvent does
  7514. nothing but return FALSE. Notice that it responds this way to a mouse-
  7515. down event even though the event may in fact have occurred in a system
  7516. window (and therefore may have to be handled by the system). The
  7517. reason for this is that the check for exactly where the event occurred
  7518. (via the Window Manager function FindWindow) is made later by the
  7519. applicaiton and so would be made twice if SystemEvent were also to do
  7520. it. To avoid this duplication, SystemEvent passes the event on to the
  7521. application and lets it make the sole call to FindWindow. Should
  7522. FindWindow reveal that the mouse-down event did occur in a system
  7523. window, the application can then call SystemClick, as described above,
  7524. to get the system to handle it.
  7525.  
  7526.     If the given event is a mouse-up or keyboard event, SystemEvent
  7527. checks whether the active window belongs to a desk accessory and whether
  7528. that accessory can handle this type of event. If so, it sends the event
  7529. to the desk accessory and returns TRUE; otherwise, it returns FALSE.
  7530.  
  7531. (note)
  7532.       It's unlikely that a desk accessory would not be set up
  7533.       to handle activate and update events.
  7534.  
  7535.     Finally, if the given event is a disk-inserted event, SylstemEvent
  7536. does some low-level processing (by calling the File Manager function
  7537. McountVol) but passes the event on to the application by returning
  7538. FALSE, in case the application wants to do further processing.
  7539. \ SystemMenu
  7540. 10
  7541. PROCEDURE SystemMenu (menuResult: LONGINT);
  7542.  
  7543.     SystemMenu is called only by the Menu Manager functions MenuSelect
  7544. and MenuKey, when an item in a menu belonging to a desk accessory has
  7545. been chosen. The menuResult parameter has the same format as the value
  7546. returned by MenuSelect and MenuKey:  the menu ID in the high-order word
  7547. and the menu item number in the low-order word. (The menu ID will be
  7548. negative.)  SystemMenu directs the desk accessory to perform the
  7549. appropriate action for the given menu item.
  7550. \ InfoScrap
  7551. 11
  7552. FUNCTION InfoScrap : PScrapStuff;
  7553.  
  7554.     dInfoScrap returns a pointer to information about the desk scrap.
  7555. The PScrapStuff data type is defined as follows:
  7556.  
  7557. TYPE PScrapStuff = ^ScrapStuff;
  7558.      ScrapStuff = RECORD
  7559.             scrapSize:    LONGINT;   {size of desk scrap}
  7560.             scrapHandle:  Handle;    {handle to desk scrap}
  7561.             scrapCount:   INTEGER;   {count changed by ZeroScrap}
  7562.             scratState:   INTEGER;   {tells where desk scrap is}
  7563.             scrapName:    StringPtr  {scrap file name}
  7564.           END;
  7565.  
  7566.  
  7567.     ScrapSize is the size of the desk scrap in bytes. ScrapHandle is a
  7568. handle to the scrap if it's in memory, or NIL if not.
  7569.  
  7570.     ScrapCount is a count that changes every time ZeroScrap is called,
  7571. and is useful for testing whether the contents of the desk scrap have
  7572. changed during the use of a desk accessory. ScrapState is positive if
  7573. the desk scrap is in memory, 0 if it's on the disk, or negative if it
  7574. hasn't been initialized by ZeroScrap.
  7575.  
  7576. (note)
  7577.        ScrapState is actually 0 if the scrap should be on the
  7578.        disk; for instance, if the user deletes the Clipboard
  7579.        file and then cuts something, the scrap is really in
  7580.        memory, but ScrapState will be 0.
  7581.  
  7582.  
  7583.     ScrapName is a pointer to the name of the scrap file, usually
  7584. "Clipboard File".
  7585.  
  7586. (note)
  7587.       InfoScrap assumes that the scrap file has a version
  7588.       number of 0 and is on the default volume. (Version
  7589.       numbers and volumes are described in the File Manager
  7590.       manual.)
  7591. \ UnloadScrap
  7592. 1
  7593. FUNCTION UnloadScrap : LONGINT;
  7594.  
  7595.     UnloadScrap writes the desk scrap from memory to the scrap file, and
  7596. relaeses the memory it occupied. If the desk scrap is already on the
  7597. disk, UnloadScrap does nothing. If no error occurs, UnloadScrap
  7598. returns the result code noErr; otherwise, it returns and Operating
  7599. System result code indicating an error.
  7600. \ LoadScrap
  7601. 11
  7602. FUNCTION LoadScrap : LONGINT;
  7603.  
  7604.     LoadScrap reads the desk scrap from the scrap file into memory. If
  7605. the desk scrap is already in memory, it does nothing. If no error
  7606. occurs, LoadScrap returns the result code noErr; otherwise, it returns
  7607. an Operating System result code indicating an error.
  7608. \ GetScrap
  7609. 11
  7610. FUNCTION GetScrap (hDest: Handle; theType: ResType; VAR offset:
  7611.                     LONGINT) : LONGINT;
  7612.  
  7613.     Given an existing handle in hDest, GetScrap reads the data of type
  7614. theType from the desk scrap (whether in memory or on the disk), makes a
  7615. copy of it in memory, and sets hDest to be a handle to the copy.
  7616. Usually you'll pass in hDest a handle to a minimum-size block; GetScrap
  7617. will resize the block and copy the scrap into it. If you pass NIL in
  7618. hDest, GetScrap will not read in the data. This is usefull if you want
  7619. to be sure the data is there before allocating space for its handle, or
  7620. if you just want to know the size of the data.
  7621.  
  7622.     In the offset parameter, GetScrap returns the location of the data
  7623. as an offset (in bytes) from the beginning of the desk scrap. If no
  7624. error occurs, the function result is the length of the data in bytes;
  7625. otherwise, it's either an appropriate Operatiing System result code
  7626. (which will be negative) or the following Scrap Manager result code:
  7627.  
  7628.         CONST noTypeErr = -102;   {no data of the requested type}
  7629.  
  7630. For example, given the declaration
  7631.  
  7632.         VAR pHndl: Handle;      {handle for 'PICT' type}
  7633.         tHndl: Handle;          {handle for 'TEXT' type}
  7634.         length: LONGINT;
  7635.         offset: LONGINT;
  7636.  
  7637. you can make the following calls:
  7638.  
  7639.         pHndl := NewHandle(0);
  7640.         length := GetScrap(pHandl,'PICT',offset);
  7641.         IF length < 0
  7642.           THEN
  7643.            {error-handling}
  7644.           ELSE DrawPicture(PicHandle(pHndl))
  7645.  
  7646.  
  7647.     If your application wants data in the form of a  picture, and the
  7648. scrap contains only text, you can convert the text into a picture by
  7649. doing the following:
  7650.  
  7651.           tHndl := NewHandle(0);
  7652.           length := GetScrap(tHndl,'TEXT',offset);
  7653.           IF length < 0
  7654.             THEN
  7655.               {error-handling}
  7656.             ELSE
  7657.               BEGIN
  7658.               HLock(tHndl);
  7659.               pHndl := OpenPicture(thePort^.portRect);
  7660.               TextBox(tHndl^,length,thePort^.portRect,teJustLeft);
  7661.               ClosePicture;
  7662.               HUnlock(tHndl);
  7663.             END
  7664.  
  7665.  
  7666.     The Memory Manager procedures HLock and HUnlock are used to lock and
  7667. unlock blocks when handles are dereferenced (see the Memory Manager
  7668. Manual).
  7669.  
  7670. (note)
  7671.       To copy the desk scrap to the TextEdit scrap, use the
  7672.       TextEdit function TEFromScrap.
  7673.  
  7674.     Your application should pass its preferred data type to GetScrap. If
  7675. it doesn't prefer one data type over any other, it should try getting
  7676. each of the types it can read, and use the type that returns the lowest
  7677. offset. (A lower offset means that this data type was written before
  7678. the others, and therefore was preferred by the application that wrote
  7679. it.)
  7680.  
  7681. (note)
  7682.       If you're trying to read in a complicated picture, and 
  7683.       there isn't enough room in memory for a copy of it, you
  7684.       can customize QuickDraw's picture retrieval so that
  7685.       DrawPicture will read the picture directly from the scrap
  7686.       file. (QuickDraw also lets you customize how pictures
  7687.       are saved so you can save them in a file; see the
  7688.       QuickDraw manual for details about customizing.)
  7689.  
  7690. (note)
  7691.       When reading in a picture from the scrap, allow a buffer
  7692.       of about 3.5K bytes.  (There's a convention that the
  7693.       application defining the picture won't call the QuickDraw
  7694.       procedure CopyBits for more than 3K, so a 3.5K buffer
  7695.       should be large enough for any picture.
  7696. \ ZeroScrap
  7697. 11
  7698. FUNCTION ZeroScrap : LONGINT;
  7699.  
  7700.     If the scrap already exists (in memory or on the disk), ZeroScrap
  7701. clears its contents; if not, the scrap is initialized in memory. You
  7702. must call ZeroScrap before the first time you call PutScrap. If no
  7703. error occurs, ZeroScrap returns the result code noErr; otherwise, it
  7704. returns an Operating System result code indicating an error.
  7705.  
  7706.     ZeroScrap also changes the scrapCount field of the record of
  7707. information provided by InfoScrap. This is useful for testing whether
  7708. the contents of the desk scrap have changed during the use of a desk
  7709. accessory. The application can save the value of the scrapCount field
  7710. when one of its windows is deactivated and a system window is
  7711. activated. Then, each time through its event loop, it can check to see
  7712. whether the value of the field has changed. If so, it means the desk
  7713. accessory called ZeroScrap (and, presumable, PutScrap) and thus changed
  7714. the contents of the desk scrap.
  7715.  
  7716. (warning)
  7717.          Just check to see whether the scrapCount field has
  7718.          changed; don't rely on exactly how it has changed.
  7719. \ PutScrap
  7720. 11
  7721. FUNCTION PutScrap (length: LONGINT; theType: ResType; source: Ptr) :
  7722.               LONGINT;
  7723.  
  7724.     PutScrap writes the data poointed to by the source parameter to the
  7725. desk scrap (in memory or on the disk). The length parameter indicates
  7726. the number of bytes to write, and theType is the data type.
  7727.  
  7728. (warning)
  7729.         The specified type must be different from the type of any
  7730.         data already in the desk scrap. If you write data of a
  7731.         type already in the scrap, the new data will be appended
  7732.         to the scrap, and subsequent GetScrap calls will still
  7733.         return the old data.
  7734.  
  7735.     If no error occurs, PutScrap returns the result code noErr;
  7736. otherwise, it returns an Operating System result code indicating an
  7737. error, or the following Scrap Manager result code:
  7738.  
  7739.        CONST noScrapErr = -100;  {desk scrap isn't initialized}
  7740.  
  7741. (note)
  7742.       To copy the TextEdit scrap to the desk scrap, use the
  7743.       TextEdit function TEToScrap.
  7744.  
  7745. (warning)
  7746.        Don't forget to call ZeroScrap to initialize the scrap or
  7747.        clear its previous contents.
  7748.  
  7749.  
  7750. \ FixRatio
  7751. 12
  7752. FUNCTION FixRatio (numer,demon: INTEGER) : Fixed;
  7753.  
  7754.     FixRatio returns the fixed-point quotient of numer and denom. Numer
  7755. or denom may be any signed integer. The result is truncated. If denom
  7756. is 0, FixRatio returns $7FFFFFFF with the sign of numer.
  7757. \ FixMul
  7758. 12
  7759. FUNCTION  FixMul (a,b: Fixed) : Fixed;
  7760.  
  7761.     FixMul returns the fixed-point product of a and b. The result is
  7762. computed MOD 65536, and truncated.
  7763. \ FixRound
  7764. 12
  7765. FUNCTION FixRound (x: Fixed) : INTEGER;
  7766.  
  7767.     Given a positive fixed-point number, FixRound rounds it to the
  7768. nearest integer and returns the result. If the value is halfway between
  7769. two integers (.5), it's rounded up. To round a negative fixed-point
  7770. number, multiply by -1, round, then multiply by -1 again.
  7771. \ NewString
  7772. 12
  7773. FUNCTION NewString (theString: Str255) : StringHandle;
  7774.  
  7775.     NewString allocates the specified string as a relocatable object on
  7776. the heap and returns a handle to it.
  7777. \ SetString
  7778. 12
  7779. PROCEDURE SetString (h: StringHandle; theString: Str255);
  7780.  
  7781.     SetString sets the string whose handle is passed in h to the string
  7782. specified by theString.
  7783. \ GetString
  7784. 12
  7785. FUNCTION GetString (stringID: INTEGER) : StringHandle;
  7786.  
  7787.     GetString returns a handle to the string having the given resource
  7788. ID, reading it from the resource file if necessary. It calls the
  7789. Resource Manager function GetResource('STR ',stringID). If the resource
  7790. can't be read, GetString returns NIL.
  7791.  
  7792. (note)
  7793.       If your application uses a large number of strings,
  7794.       storing them in a string list in the resource file will
  7795.       be more efficient. You can access strings in a string
  7796.       list with GetIndString, as described below.
  7797. \ GetIndString
  7798. 12
  7799. PROCEDURE GetIndString (VAR theString: Str255; strListID: INTEGER;
  7800.              Index: INTEGER);    [No trap macro]
  7801.  
  7802.     GetIndString returns in theString a string in the string list that
  7803. has the resource ID strListID. It reads the string list from the
  7804. resource file if necessary, by calling the Resource Manager function
  7805. GetResource('STR#',strListID). It returns the string specified by the
  7806. index parameter, which can range from 1 to the number of strings in the
  7807. list. If the resource can't be read or the index is out of range, the 
  7808. empty string is returned.
  7809. \ Munger
  7810. 12
  7811. FUNCTION Munger (h: Handle; offset: LONGINT; ptrl: Ptr; lenl: LONGINT;
  7812.                     ptr2: Ptr; len2: LONGINT) : LONGINT;
  7813.  
  7814.     Munger (which rhymes with "plunger") lets you manipulate bytes in
  7815. the string of bytes (the "destination string") to which h is a handle.
  7816. The operation starts at the specified byte offset in the destination
  7817. string.
  7818.  
  7819. (note)
  7820.       Although the term "string" is used here, Munger does not
  7821.       assume it's manipulating a Pascal string; if you pass it
  7822.       a handle to a Pascal string, you must take into account
  7823.       the length byte.
  7824.  
  7825.     The exact nature of the operation done by Munger depends on the
  7826. values you pass it in two pointer/length parameter pairs. In general,
  7827. (ptr1,len1) defines a target string to be replaced by the second string
  7828. (ptr2,len2). If these four parameters are all positive and nonzero,
  7829. Munger looks for the target string in the destination string, starting
  7830. from the given offset and ending at the end of the string; it replaces
  7831. the first occurrence it finds with the replacement string and returns
  7832. the offset of the first byte past where the replacement occurred.
  7833. Figure 1 illustrates this; the bytes represent ASCII characters as
  7834. shown.
  7835.  
  7836.     Different operations occur if either pointer is NIL or either length
  7837. is 0:
  7838.  
  7839.     - If ptr1 is NIL, the substring of length len1 starting at the given
  7840.       offset is replaced by the replacement string. If len1 is
  7841.       negative, the substring from the given offset to the end of the
  7842.       destination string is replaced by the replacement string. In
  7843.       either case, Munger returns the offset of the first byte past
  7844.       where the replacement occurred.
  7845.  
  7846.  
  7847.     - If len1 is 0, (ptr2,len2) is simply inserted at the given offset;
  7848.       no text is replaced. Munger returns the offset of the first byte
  7849.       past where the insertion occurred.
  7850.  
  7851.     - If ptr2 is NIL, Munger returns the offset at which the targer
  7852.       string was found. The destination string isn't changed.
  7853.  
  7854.     - If ptr2 is NIL, Munger returns the offset at which the target
  7855.       string was found. The destination string isn't changed.
  7856.  
  7857.     - If len2 is 0 (and ptr2 is not NIL), the target string is deleted
  7858.       rather than replaced (since the replacement string is empty).
  7859.       Munger returns the offset at which the deletion occurred.
  7860.  
  7861.  
  7862.     If it can't find the target string in the destination string, Munger 
  7863. returns a negative value.
  7864.  
  7865.     There's one case in which Munger performs a replacement even if it
  7866. doesn't find all of the target string. If the substring from the
  7867. offset to the end of the destination string matches the beginning of
  7868. the target string, the portion found is replaced with the replacement
  7869. string.
  7870.  
  7871. (warning)
  7872.         Be careful not to specify an offset that's greater than
  7873.         the length of the destination string, or unpredictable
  7874.         results may occur.
  7875.  
  7876. (note)
  7877.         The destination string must be in a relocatable block
  7878.         that was allocated by the Memory Manager. Munger
  7879.         accesses the string's length by calling the Memory
  7880.         Manager routines GetHandleSize and SetHandleSize.
  7881. \ PackBits
  7882. 12
  7883. PROCEDURE PackBits (VAR srcPtr,DstPtr: Ptr; srcBytes: INTEGER);
  7884.  
  7885.     PackBits compresses srcBytes bytes of data starting at srcPtr and
  7886. stores the compressed data at dstPtr. The value of srcBytes should not
  7887. be greater than 127. Bytes are compressed when there are three or more
  7888. consecutive equal bytes. After the data is compressed, srcPtr is
  7889. incremented by srcBytes and dstPtr is incremented by the number of
  7890. bytes that the data was compressed to. In the worst case, the
  7891. compressed data can be one byte longer than the original data.
  7892.  
  7893.     PackBits is usually used to compress QuickDraw bit images; in this
  7894. case, you should call it for one row at a time. (Because of the
  7895. repeating patterns in QuickDraw images, there are more likely to be
  7896. consecutive equal bytes there than in other data.)  Use UnpackBits
  7897. (below) to expand data compressed by PackBits.
  7898. \ UnpackBits
  7899. 12
  7900. PROCEDURE UnpackBits (VAR SrcPtr, DstPtr: Ptr; dstBytes: Integer);
  7901.  
  7902.     Given in SrcPtr a pointer to the data that was compressed by PackBits,
  7903. UnpackBits expands the data and stores the result as DstPtr. DstBytes is
  7904. the length that the expanded data will be; it should be the value that was
  7905. passed to PackBits in the SrcBytes parameter. After the data is expanded,
  7906. srcPtr is incremented by the number of bytes that were expanded and dstPtr
  7907. is incremented by dstBytes.
  7908. \ BitTst
  7909. 12
  7910. FUNCTION BitTst (BytePtr: Ptr; bitNum: Longint): Boolean;
  7911.  
  7912.     BitTst tests wether a given bit is set and returns TRUE if so or FALSE
  7913. if not. The bit is specified by bitNum, an offset from the high-order bit
  7914. of the byte pointed to by BytePtr.
  7915. \ BitSet
  7916. 12
  7917. PROCEDURE BitSet (BytePtr: Ptr; bitNum: Longint);
  7918.  
  7919.     BitSet sets the bit specified by bitNum, an offset from the high-order
  7920. bit of the byte pointed to by BytePtr.
  7921. \ BitClear
  7922. 12
  7923. PROCEDURE BitClear (BytePtr: Ptr; bitNum: Longint);
  7924.  
  7925.     BitClear clears the bit specified by bitNum, an offset from the
  7926. high-order bit of the byte pointed to by BytePtr.
  7927. \ BitAnd
  7928. 12
  7929. FUNCTION BitAnd (Value1, Value2: Longint): Longint;
  7930.  
  7931.     BitAnd returns the value of the AND logical operation on the bits
  7932. comprising the given long integers ( vallue1 AND value2).
  7933. \ BitOr
  7934. 12
  7935. FUNCTION BitOr (Value1, Value2: Longint): Longint;
  7936.  
  7937.     BitOr returns the value of the OR logical operation on the bits
  7938. comprising the given long integers ( vallue1 OR value2).
  7939. \ BitXor
  7940. 12
  7941. FUNCTION BitXor (Value1, Value2: Longint): Longint;
  7942.  
  7943.     BitXor returns the value of the XOR logical operation on the bits
  7944. comprising the given long integers ( vallue1 XOR value2).
  7945. \ BitNot
  7946. 12
  7947. FUNCTION BitNot (Value: Longint): Longint;
  7948.  
  7949.     BitNot returns the result of the NOT logical opeation on the bits
  7950. comprisisng the given long integer (NOT value).
  7951. \ BitShift
  7952. 12
  7953. FUNCTION BitShift (Value: Longint; count: Integers): Longint;
  7954.  
  7955.     BitShift logically shifts the bits of the giveb long integer. The count
  7956. parameter specifies the direction and the extent of the shift, and is token
  7957. MOD 32. If count is positive, BitShift shifts that many positions to the
  7958. left; if count is negative, it shifts to the right. Zeroes are shifted into
  7959. empty positions at their end.
  7960. \ HiWord
  7961. 12
  7962. FUNCTION HiWord (x: Longint): Integer;
  7963.  
  7964.     HiWord returns the high-order word of the given long integer. One use
  7965. of this function is to extract the integer part of a fixed-point number.
  7966. \ LoWord
  7967. 12
  7968. FUNCTION LoWord (x: Longint): Integer;
  7969.  
  7970.     LoWord returns the low-order word of the given long integer. One use
  7971. of this function is to extract the fractional part of a fixed-point number.
  7972.  
  7973.     Note: If you're dealing with a long intger that contains two separate
  7974.     integer values, you can define a variant record instead of using
  7975.     HiWord and LoWord. For example, for fixed-point numbers, you can define
  7976.     the following type:
  7977.  
  7978.       TYPE FixedAndInt = RECORD CASE Integer OF
  7979.                             1: (FixedView: Fixed);
  7980.                             2: (intView:   RECORD
  7981.                                             Whole: Integer;
  7982.                                             Part : Integer;
  7983.                                            END;)
  7984.                           END;
  7985.  
  7986.     If you declare x to be of type FixedAndInt, you can access it as a
  7987.     fixed-point value with x.FixedView, or access the integer part with
  7988.     x.intView.Whole aand the fractional part with x.intView.part.
  7989. \ LongMul
  7990. 12
  7991. PROCEDURE LongMul (a,b: Longint; VAR dest: Int64bit);
  7992.  
  7993.     LongMul multiplies the given long integers and returns the signed
  7994. result in dest which has the following data type:
  7995.  
  7996.     TYPE Int64Bit = RECORD
  7997.                       HiLong: Longint;
  7998.                       LoLong: Longint;
  7999.                     END;
  8000. \ ScreenRes
  8001. 12
  8002. PROCEDURE ScreenRes (VAR scrnHRes, scrnVRes: Integer); [Not in ROM]
  8003.  
  8004.     ScreenRes returns the resolution of the screen of the macintosh being
  8005. used. ScrnHRes and scrnVRes are the number of pixels per inch horizontally
  8006. and verticaly, respectively.
  8007.  
  8008.         ____________________________________________________________
  8009.          Assembly-language note: The number of pixels per  inch
  8010.          horizontally is stored in the global variable ScrHRes, and
  8011.          the number of pixels per inch vertically is stored in
  8012.          ScrVRes.
  8013.         ____________________________________________________________
  8014. \ GetIcon
  8015. 12
  8016. FUNCTION GetIcon (IconId: Integer): Handle;
  8017.  
  8018.     GetIcon returns a handle to the icon having the given resource ID,
  8019. reading it from the resource file if necessary. It calls the resource
  8020. manager function GetResource ('ICON', IconId). If the resource can't be
  8021. read, GetIcon returns NIL.
  8022. \ PlotIcon
  8023. 12
  8024. PROCEDURE PlotIcon (TheRect: Rect; TheIcon: Handle);
  8025.     PlotIcon draws the icon whose handle is theIcon in the rectangle
  8026. TheRect, which is in the local coordinate of the current grafport. It calls
  8027. the QuickDraw procedure CopyBits and uses the srcCopy transfer mode.
  8028. \ GetPattern
  8029. 12
  8030. FUNCTION GetPattern (PatID: Integer): PatHandle;
  8031.  
  8032.     GetPattern returns a handle to the pattern  having the given resource
  8033. ID, reading it from the resource file if necessary. It calls the resource
  8034. manager function  GetResource ('PAT ', PatId). If the resource can't be
  8035. read, GetPattern returns NIL. The PatHandle data type is defined in the
  8036. toolbox utilities as follows:
  8037.  
  8038.     TYPE  PatPtr    = ^Pattern;
  8039.           PatHandle = ^PatPtr;
  8040. \ GetIndPattern
  8041. 12
  8042. Function GetIndPattern (VAR ThePattern: Patter; PatLisId: Integer; Index:
  8043.                         Integer);  [Not in ROM]
  8044.  
  8045.     GetIndPattern returns in the pattern a pattern in the pattern list that
  8046. has the resource ID PatListID. It reads the pattern list from the resource
  8047. file if necessary, by calling the Resource Manager function
  8048. GetResource ('PAT#', PatListID). It returns the pattern specified by the
  8049. index parameter, which can range from 1 to the number of patterns in the
  8050. pattern list.
  8051.  
  8052.     There's a pattern list in the system resource file that contains the
  8053. standard Macintosh patterns used by MacPaint. Its resource ID is :
  8054.  
  8055.     CONST   SysPatListID = 0;
  8056. \ GetCursor;
  8057. 12
  8058. FUNCTION GetCursor (CursorID: Integer): CursHandle;
  8059.  
  8060.     GetCursor returns a handle to the cursor having the given resource ID,
  8061. reading it forme the resource file if necessary. It calls the resource
  8062. manager function GetResource ('CURS', CursorIdD). If the resource can't be
  8063. read, GetCursor returns NIL. The CursHandle data type is defined in the
  8064. toolbox utilities as follows:
  8065.  
  8066.     TYPE    CursPtr    = ^Cursor;
  8067.             CursHandle = ^CursPtr;
  8068.  
  8069.     The standard cursors are defined in the system resource file. Their
  8070. resources ID are:
  8071.  
  8072.     CONST   iBeamCursor = 1; {to select text}
  8073.             crossCursor = 2; {to draw graphics}
  8074.             plusCursor  = 3; {to select cells in structured documents}
  8075.             watchCursor = 4; {to indicate a too long wait}
  8076.  
  8077.  
  8078.     Note: You can set the cursor with the quickdraw procedure SetCursor.
  8079.     The arrow cursor is defined in QuickDraw as a global variable named
  8080.     Arrow.
  8081. \ ShieldCursor
  8082. 12
  8083. PROCEDURE ShieldCursor (shieldRect: Rect; OffsetPt: Point);
  8084.  
  8085.     If the cursor and the given rectangle intersect, ShieldCursor hides the
  8086. cursor. If they don't intersect, the cursor remains visible while the mouse
  8087. isn't moving, but is hidden when the mouse moves.
  8088.  
  8089.     Like the QuickDraw procedure HideCursor, ShieldCursor decrements the
  8090. cursor level,  and should be balanced by a call to ShowCursor.
  8091.  
  8092.     The rectangle may be given in local or global coordinates:
  8093.  
  8094. •  If they're global coordinates, pass (0, 0) in OffsePt.
  8095. •  If they're a grafport's local coordinates, pass the top left corner of
  8096.    the grafport's boundary rectangle in OffsetPt. (Like the QuickDraw
  8097.    procedure LocalToGlobal, ShieldCursor will offset the coordinates of
  8098.    the rectangle by the coordinate of this point.)
  8099. \ GetPicture
  8100. 12
  8101. FUNCTION GetPicture (PicID: Integer): PicHandle;
  8102.  
  8103.     GetPicture returns a handle to the picture having the given resource
  8104. ID, reading it from the resource file if necessary. It calls the resource
  8105. Manager function GetResource ('PICT', PicID). If the resource can't be read
  8106. GetPicture returns NIL. The PicHandle data type is defined in QuickDraw.
  8107. \ DeltaPoint
  8108. 12
  8109. FUNCTION DeltaPoint (ptA, ptB: Point): Longint;
  8110.  
  8111.     DeltaPoint substracts the coordinates of ptB from the coordinates of
  8112. ptA. The high-order word of the result is the difference of the vertical
  8113. coordinates, and the low-order word is the difference of the horizontal
  8114. coordinates.
  8115.  
  8116.     NOTE : The QuickDraw procedure SubPt also substracts the coordinates
  8117.     of one point, but returns the result in a VAR parameter of type Point.
  8118. \ SlopeFromAngle
  8119. 12
  8120. FUNCTION SlopeFromAngle (Angle: Integer): Fixed;
  8121.  
  8122.     Given an angle, SlopeFromAngle returns the slope dh/dv of the line
  8123. forming that angle with the Y-axis (dh/dv is the horizontal change divided
  8124. by the vertical  change between any two points on the line). The angle is
  8125. treated MOD 180, and its degrees measured from 12 o'clock; positive degrees
  8126. are measured clockwise, negative degrees are measured counterclockwise (for
  8127. example, 90 degrees is at 3 o'clock, and -90 degrees is at 9 o'clock).
  8128. Positive y is down; positive x is to the right.
  8129. \ AngleFromSlope
  8130. 12
  8131. Function AngleFromSlope (Slope: Fixed): Integer;
  8132.  
  8133.     Given the slope dh/dv of a line (see SlopeFromAngle), AngleFromSlope
  8134. returns the angle formed by that line and the y-axis. The angle returned
  8135. is between 1 and 180 (inclusive), in degrees measured clockwise from 12
  8136. o'clock.
  8137.  
  8138.     AngleFromSlope is meant for use when speed is much more important than
  8139. accuracy - its integer result is guaranted to be one degree of the correct
  8140. answer,  but not necessarily within half a degree. However the equation
  8141.  
  8142.     AngleFromSlope(SlopeFromAngle(x))= x
  8143.  
  8144. is true for all x except 0 (although reverse is not).
  8145.  
  8146.     NOTE : SlopeFromAngle(0) is 0, and AngleFromSlope(0) is 180.
  8147. \ FracMul
  8148. 12
  8149. FUNCTION FracMul (x,y: Fract) : Fract;
  8150.  
  8151. FracMul returns x * y. Note that FracMul effects
  8152.  
  8153. “type   *   Fract   —>  type”:
  8154. Fract   *   Fract   —>  Fract
  8155. LONGINT *   Fract   —>  LONGINT
  8156. Fract   *   LONGINT —>  LONGINT
  8157. Fixed   *   Fract   —>  Fixed
  8158. Fract   *   Fixed   —>  Fixed
  8159. \FixDiv
  8160. 12
  8161. FUNCTION FixDiv (x,y: Fixed) : Fixed;
  8162.  
  8163. FixDiv returns x / y.
  8164. \FracDiv
  8165. 12
  8166. FUNCTION FracDiv (x,y: Fract) : Fract;
  8167.  
  8168. FracDiv returns x / y.
  8169. \FracSqrt
  8170. 12
  8171. FUNCTION FracSqrt (x: Fract) : Fract;
  8172.     FracSqrt returns the square root of x, with x interpreted as
  8173. unsigned in the range 0 through 4–(2–30), inclusive:  That is, bit 15 in
  8174. Figure 1 has weight 2 rather than –2. The result, too, is unsigned
  8175. in the range 0 through 2, inclusive.
  8176. \FracCos
  8177. 12
  8178. FUNCTION FracCos (x: Fixed) : Fract;
  8179.     FracCos and FracSin return the cosine and sine of their radian
  8180. arguments, respectively. The hexadecimal value 0.C910 (which is
  8181. FixATan2(1,1)) is the approximation to π/4 used for argument reduction.
  8182. Thus, FracCos and FracSin are nearly periodic, but with period 2*P
  8183. instead of 2*π, where P=3.1416015625 and π, of course, is 3.14159265....
  8184. \FracSin
  8185. 12
  8186. FUNCTION FracSin (x: Fixed) : Fract;
  8187.  
  8188.     FracCos and FracSin return the cosine and sine of their radian
  8189. arguments, respectively. The hexadecimal value 0.C910 (which is
  8190. FixATan2(1,1)) is the approximation to π/4 used for argument reduction.
  8191. Thus, FracCos and FracSin are nearly periodic, but with period 2*P
  8192. instead of 2*π, where P=3.1416015625 and π, of course, is 3.14159265....
  8193. \FixATan2
  8194. 12
  8195. FUNCTION FixATan2 (x,y: LONGINT) : Fixed;
  8196.  
  8197.     FixATan2 returns the arctangent of y / x in radians.
  8198. \Long2Fix
  8199. 12
  8200. FUNCTION Long2Fix (x: LONGINT) : Fixed;
  8201.  
  8202.     Long2Fix, Fix2Long, Fix2Frac, and Frac2Fix convert between
  8203. fixed-point types.
  8204. \Fix2Long
  8205. 12
  8206. FUNCTION Fix2Long (x: Fixed) : LONGINT;
  8207.  
  8208. Long2Fix, Fix2Long, Fix2Frac, and Frac2Fix convert between fixed-point
  8209. types.
  8210. \Fix2Frac
  8211. FUNCTION Fix2Frac (x: Fixed) : Fract;
  8212.  
  8213. Long2Fix, Fix2Long, Fix2Frac, and Frac2Fix convert between fixed-point
  8214. types.
  8215. \Frac2Fix
  8216. 12
  8217. FUNCTION Frac2Fix (x: Fract) : Fixed;
  8218.  
  8219. Long2Fix, Fix2Long, Fix2Frac, and Frac2Fix convert between fixed-point
  8220. types.
  8221.  
  8222. \Fix2X
  8223. 12
  8224. FUNCTION Fix2X  (x: Fixed) : Extended;
  8225.  
  8226. Fix2X, X2Fix, Frac2X, and X2Frac convert between Fixed and Fract
  8227. and the Extended floating-point type. These functions do not set
  8228. floating-point exception flags.
  8229. \X2Fix
  8230. 12
  8231.  
  8232. Fix2X, X2Fix, Frac2X, and X2Frac convert between Fixed and Fract
  8233. and the Extended floating-point type. These functions do not set
  8234. floating-point exception flags.
  8235. FUNCTION X2Fix  (x: Extended) : Fixed;
  8236. \Frac2X
  8237. 12
  8238. FUNCTION Frac2X (x: Fract) : Extended;
  8239.  
  8240. Fix2X, X2Fix, Frac2X, and X2Frac convert between Fixed and Fract
  8241. and the Extended floating-point type. These functions do not set
  8242. floating-point exception flags.
  8243. \X2Frac
  8244. 12
  8245. FUNCTION X2Frac (x: Extended) : Fract;
  8246.  
  8247. Fix2X, X2Fix, Frac2X, and X2Frac convert between Fixed and Fract
  8248. and the Extended floating-point type. These functions do not set
  8249. floating-point exception flags.
  8250.  
  8251. \ InitPack
  8252. 13
  8253. PROCEDURE InitPack (packID: INTEGER);
  8254.  
  8255.     InitPack enables you to use the package specified by packID, which
  8256. is the package's resourceID. (It gets a handle that will be used later
  8257. to read the package into memory.)
  8258. \ InitAllPacks
  8259. 13
  8260. PROCEDURE InitAllPacks;
  8261.  
  8262.     InitAllPacks enables you to use all Macintosh packages (as though
  8263. InitPack were called for each one). It wil already have been called
  8264. when your application starts up.
  8265. \ IUDateString
  8266. 13
  8267. PROCEDURE IUDateString (dateTime: LongInt; form: DateForm; VAR result:
  8268.                         Str255);
  8269.  
  8270.     Given a date and time as returned by the Operating System Utility
  8271. routine ReadDateTime, IUDateString returns in the result parameter a
  8272. string that represents the corresponding date. The form parameter has
  8273. the following data type:
  8274.  
  8275.        TYPE DateForm = (shortDate,longDate,abbrevDate);
  8276.  
  8277.     ShortDate requests the short date format, longDate the long date,
  8278. and abbrevDate the abbreviated long date. IUDateString determines the
  8279. exact format from international resource 0 for the short date of 1 for
  8280. the long date. See Figure I-1 above for examples of the standard
  8281. formats. Notice that the short date contains a space in place of  a
  8282. leading zero when the format specifies "no leading zero", so the length
  8283. of the result is always the same for short dates.
  8284.  
  8285.     If the abbreviated long date is requested and the abbreviation
  8286. length in international resource 1 is greater than the actual length of
  8287. the name being abbreviated, IUDateString fills the abbreviation with NUL
  8288. characters; the abbreviation length should not be greater than 15, the
  8289. maximum name length.
  8290. \ IUDatePString
  8291. 13
  8292. PROCEDURE IUDatePString (dateTime: LongInt; form: DateForm; VAR result:
  8293.             Str255; intlParam: Handle);
  8294.  
  8295.  
  8296.     IUDatePString is the same as IUDateString except that it determines
  8297. the exact format of the date from the resource whose handle is passed in
  8298. intlParam, overriding the resource that would otherwise be used.
  8299. \ IUTimeString
  8300. 13
  8301. PROCEDURE IUTime STring (dateTime: LongInt; wantSeconds: BOOLEAN; VAR
  8302.             result: Str255);
  8303.  
  8304.     Given a date and time as returned by the Operating System Utility
  8305. routein ReadDateTime, IUTimeString returns in the result parameter a
  8306. string that represents the corresponding time of day. If wantSeconds
  8307. is TRUE, seconds are included in the time; otherwise, only the hour and
  8308. minute are included. IUTimeSting determines the time format from
  8309. internation resource 0. See Figure I-1 above for examples of the
  8310. standard formats. Notice that the time contains a space in place of a
  8311. leading zero when the format specifies "no leading zero", so the length
  8312. of the result is always the same.
  8313. \ IUTimePString
  8314. 13
  8315. PROCEDURE IUTimePString (dateTime: LongInt; wantSeconds: BOOLEAN; VAR
  8316.             result: str255; intlParam: Handle);
  8317.  
  8318.     IUTimePString is the same as IUTimeString except that it determines
  8319. the time format from the resource whose handle is passed in intlParam,
  8320. overriding the resource that would otherwise be used.
  8321. \ IUMetric
  8322. 13
  8323. FUNCTION IUMetric : BOOLEAN;
  8324.  
  8325.     If international resource 0 specifies that the metric system is to
  8326. be used, IUMetric retruns TRUE; otherwise, it returns FALSE.
  8327. \ IUGetIntl
  8328. 13
  8329. FUNCTION IUGetIntl (theID: INTEGER) : Handle;
  8330.  
  8331.     IUGetIntl returns a handle to the international resource numbered
  8332. theID (0 or 1). It calls the Resource Manager function
  8333. GetResource('INTL',theID). For example, if you want to access
  8334. individual fields of international resource 0, you can do the
  8335. following:
  8336.  
  8337.      VAR myHndl: Handle;
  8338.          int0: Intl0Hndl;
  8339.      ...
  8340.      myHndl := IUGetIntl(0);
  8341.      int0 := POINTER(ORD(myHndl));
  8342. \ IUSetIntl
  8343. 13
  8344. PROCEDURE IUSetIntl (refNum: INTEGER; thefID; INTEGER; intlParam:
  8345.             Handle);
  8346.  
  8347.     In the resource file having the reference number refNum, IUSetIntl
  8348. sets the international resource numbered theID (0 or 1) to the data
  8349. pointed to by tintlParam. The data may be either an existing resource
  8350. okr data that hasn't yet been written to a resource file. IUSetIntl
  8351. adds the resource to the specified file or replaces the resource if it's
  8352. already there.
  8353. \ IUCompString
  8354. 13
  8355. FUNCTION IUCompString (aStr,bStr: Str255) : INTEGER;  [Pascal only]
  8356.  
  8357.     IUCompString compares aStr and bStr as described above under
  8358. "International String Comparison", taking both primary and secondary
  8359. ordering into consideration. It returns one of the values listed
  8360. below.
  8361.  
  8362.       Result   Meaning                           Example
  8363.                                               aStr     bStr
  8364.        -1       aStr is less than bStr       'Ab'     'ab'
  8365.         0       aStr  equals bStr            'Ab'     'Ab'
  8366.         1       aStr is greater than bStr    'Ac'     'ab'
  8367. \ IUMagString
  8368. 13
  8369. FUNCTION IUMagString (aPtr,bPtr: Ptr; aLen,bLen: INTEGER) : INTEGER;
  8370.  
  8371.     IUMagString is the same as IUCompString (above) except that instead
  8372. of comparing two Pascal strings, it compares the string defined by aPtr
  8373. and aLen to the string defined by bPtr and bLen. The pointer points to
  8374. the first character of the string (any byte in memory, not necesarily
  8375. word-aligned), and the length specifies the number of characters in the
  8376. string.
  8377. \ IUEqualString
  8378. 13
  8379. FUNCTION IUEqualString (aStr,bStr: Str255) : INTEGER;   [Pascal only]
  8380.  
  8381.     IUEqualString comapares aStr and bStr for equality without regard
  8382. for secondary ordering, as described above under "international String
  8383. Comparison". If the strings are equal, it returns 0; otherwise, it
  8384. returns 1. For example, if the strings are 'Rose' and 'rose',
  8385. IUEqualString considers them equal and returns 0.
  8386.  
  8387. (note)
  8388.       See also EqualString in the Operating System Utilities
  8389.       manual *** doesn't yet exist***.
  8390. \ IUMagIDString
  8391. 13
  8392.     IUMagIDString is the same as IUEqualString (above) except that
  8393. instead of comparing two Pascal strings, it compares the string defined
  8394. by aPtr and aLen to the string defined by bPtr and bLen. The pointer
  8395. points to the first character of the string (any byte in memory, not
  8396. necessarily word-aligned), and the length specifies the number of4
  8397. characters in the string.
  8398. \ NumToString
  8399. 13
  8400. PROCEDURE NumToString (theNum: LongInt; VAR theStringd: Str255);
  8401.  
  8402. ____________________________________________________________________
  8403.  
  8404. Trap macro     _NumToString
  8405.  
  8406. On entry       A0:  pointer to theString (length byte followed
  8407.                   by characters)
  8408.  
  8409.              D0:  theNum (long integer)
  8410.  
  8411. On exit         A0:  pointer to theString
  8412.  
  8413. _____________________________________________________________________
  8414.  
  8415.     NumToString converts theNum to a string that represents its decimal
  8416. value, and returns the result in theString. If the value is negative,
  8417. the string begins with a minus sign; otherwise, the sign is omitted.
  8418. Leading zeroes are suppressed, except that the value 0 produces '0'.
  8419. For example:
  8420.  
  8421.      theNum          theString
  8422.       12              '12'
  8423.      -23             '-23'
  8424.        0              '0'
  8425. \ StringToNum
  8426. 13
  8427. PROCEDURE StringToNum (theString: Str255; VAR theNum: LongInt);
  8428.  
  8429. ___________________________________________________________________
  8430.  
  8431. Trap macro     _StringToNum
  8432.  
  8433. On entry       A0:  pointer to theString (length byte followed
  8434.                   by characters)
  8435.  
  8436. On exit        DO:  theNum (long integer)
  8437.  
  8438. ___________________________________________________________________
  8439.  
  8440.  
  8441.     Given a string representing a decimal integer, StringToNum converts
  8442. it to the corresponding integer and returns the result in theNum. The
  8443. string may begin with a plus or minus sign. For example:
  8444.  
  8445.       theString          theNum
  8446.         '12'               12
  8447.        '-23'              -23
  8448.         '-0'                0
  8449.        '055'               55
  8450.  
  8451.     The magnitude of the integer is converted modulo 2^32, and the
  8452. 32-bit result is negated if the string begins with a minus sign; integer
  8453. overflow occurs if the magnitude is greater than 2^31-1. (Negation is
  8454. done by taking the two's complement--reversing the state of each bit
  8455. adn then ading 1.)  For example:
  8456.  
  8457.         theString                                   theNum
  8458.        '2147483648'  (magnitude is 2^31)          -2147483648
  8459.       '-2147483648'                               -2147483648
  8460.        '4294967295'  (magnitude is 2^31)              -1
  8461.       '-4294967295'                                    1
  8462.  
  8463.     StringToNum doesn't actually check whether the characters in the
  8464. string are between '0' and '9'; instead, since the ASCII codes for '0'
  8465. through '9' are $30 through $39, it just masks off the last four bits
  8466. and uses them as a digit. For example, '2:' is converted to the number
  8467. 30 because the ASCI code for ':' is $3A. Leading spaces before the
  8468. first digit are treated as zeroes, since the ASCII code for a space is
  8469. $20. Given that the ASCII codes for 'C', 'A', and 'T' are $43, $41, and
  8470. $54, respectively, consider the following examples:
  8471.  
  8472.  
  8473.       theString              theNum
  8474.         'CAT'                  314
  8475.        '+CAT'                  314
  8476.        '-CAT'                 -314
  8477. \ SFPutFile
  8478. 13
  8479. PROCEDURE SFPutFile (where: Point; prompt: Str255; origName: Str255;
  8480.                     dlgHook: ProPtr; VAR reply: SFReply);
  8481.  
  8482.     SFPutFile displays a dialog box allowing the user to specify a file
  8483. to which data will be written (as during a Save or Save As command). It
  8484. then repeatedly gets and handles events until the user either confirms
  8485. the command after entering an appropriate file name or aborts the
  8486. command by clicking Cancel in the dialog. It reports the user's reply
  8487. by filling the fields of the reply record specified by the reply
  8488. parameter, as described above; the fType field of this record isn't
  8489. used.
  8490.  
  8491.     The general appearance of the standard SFPutFile dialog box is shown
  8492. in Figure S-2. The where parameter specifies the location of the top
  8493. left corner of the dialog box in global coordinates. The prompt
  8494. parameter is a line of text to be displayed as a statText item in the
  8495. dialog box, where shown in Figure S-2. The origName parameter contains
  8496. text that appears as an enabled, selected editText item; for the
  8497. standard document-saving commands, it should be the current name of the
  8498. document, or the empty string (to display an insertion point) if the
  8499. document hasn't been named yet.
  8500.  
  8501.     If you want to use the standard SFPutFile dialog box, pass NIL for
  8502. dlgHook; otherwise, see the information for advanced programmers below.
  8503.  
  8504.     SFPutFile  repeatedly calls the Dialog Manager procedure
  8505. ModalDialog. When an event involving an enabled dialog item occurs,
  8506. ModalDialog handles the event andf returns the item number, and
  8507. SFPutFile responds as follows:
  8508.  
  8509.    - If the Eject or Drive button is clicked, or a disk is inserted,
  8510.      SFPutFile responds as described above under "About the Standard
  8511.      File Package".
  8512.  
  8513.    - Text entered into the editText item is stored in the fName field
  8514.      of the reply record. (SFPutFile keeps track of whetehr there's
  8515.      currently any text in the item, and makes the Save button inactive
  8516.      if not.)
  8517.  
  8518.    - If the Save button is clicked, SFPutFile determines whether the
  8519.      file name in the fName field of the reply record is appropriate.
  8520.      If so, it returns control to the application with the first field
  8521.      of the reply record set to TRUE; otherwise, it responds
  8522.      accordingly, as described below.
  8523.  
  8524.   - If the Cancel button in the dialog is clicked, SFPutFile returns
  8525.     control to the application with the first field of the reply
  8526.     record set to FALSE.
  8527.  
  8528. (note)
  8529.        Notice that disk insertion is one of the user actions
  8530.        listed above, even though ModalDialog normally ignores
  8531.        disk-inserted events. The reason this works is that
  8532.        SFPutFile calls ModalDialog with a filterProc function
  8533.        that checks for a disk-inserted event and returns a
  8534.        "fake", very large item number if one occurs; SFPutFile
  8535.        recognizes this item number as an indication that a disk
  8536.        was inserted.
  8537.  
  8538.     The situations that may cause an entered name to be inappropriate,
  8539. and SFPutFile's response to each, are as follows:
  8540.  
  8541.      - If a file with the specified name already exists on the disk and
  8542.        is different from what was passed in the origName parameter, the
  8543.        alert in Figure S-3 is displayed. If the user clicks Yes, the
  8544.        file name is appropriate.
  8545.  
  8546.      - If the disk to which the file shoud be written is locked, the
  8547.        alert in Figure S-4 is displayed. If a system error occurs, a
  8548.        similar alert is displayed, with a corresponding message
  8549.        explaining the problem.
  8550.  
  8551. (note)
  8552.        The user may specify a disk name (preceding the file name
  8553.        and separated from it by a colon). If the disk isn't
  8554.        currently in a drive, an alert similar to the one in
  8555.        Figure S-4 is displayed. The ability to specify a disk
  8556.        name is supported for historical reasons only; users
  8557.        should not be encouraged to do it.
  8558.  
  8559.     After the user clicks No or Cancel in response to one of these
  8560. alerts, SFPutFile dismisses the alert box and continues handling events
  8561. (so a different name may be entered).
  8562.  
  8563. Advanced programmers:  You can create your own dialog box rather than
  8564. use the standard SFPutFile dailog. To do this, you must provide your
  8565. own dialog template and store it in your application's resource file
  8566. with the same resource ID that the standard template has in the system
  8567. resource file:
  8568.  
  8569.         CONST putDlgID = -3999;   {SFPutFile dialog template ID}
  8570.  
  8571. (note)
  8572.        The SFPPutFile procedure, described below lets you use
  8573.        any resource ID for your nonstandard dialog box.
  8574.  
  8575.     Your dialog template must specify that the dialog window be
  8576. invisible, and your dialog must contain all the standard items, as
  8577. listed below. The appearance and location of these items in your dialog
  8578. may be different. You can make an item "invisible" by giving it a
  8579. display rectangle that's off the screen. The display rectangle for each
  8580. item in the standard dialog box is given below. The rectangle for the
  8581. standard dialog box itself is (0,0,304,104).
  8582.  
  8583.  
  8584.    Item Number  Item                     Standard display rectangle
  8585.     1       Save button                  (12,74,82,92)
  8586.     2       Cancel button                (114,74,184,92)
  8587.     3       Prompt string (statText)     (12,12,184,28)
  8588.     4       UserItem for disk name       (209,16,295,34)
  8589.     5       Eject button                 (217,43,287,61)
  8590.     6       Drive button                 (217,74,287,92)
  8591.     7       EditText item for file name  (14,34,182,50)
  8592.     8       UserItem for gray line       (200,16,201,88)
  8593.  
  8594.  
  8595. (note)
  8596.        Remember that the display rectangle for any "invisible"
  8597.        item must be at least about 20 pixels wide. *** This
  8598.        will be discussed in a future draft of the Dialog Manager
  8599.        manual. ***
  8600.  
  8601.  
  8602.     If your dialog has addition items beyond the standard ones, or if
  8603. you want to handle any of the standard items in a nonstandard manner,
  8604. you must write your own dlgHook funciton and point to it with dlgHook.
  8605. Your dlgHook function should have two parameters and return an integer
  8606. value. For example, this is how it wokuld be declared if it were named
  8607. MyDlg:
  8608.  
  8609.        FUNCTION MyDlg (item: INTEGER; theDialog: DialogPtr) : INTEGER;
  8610.  
  8611.     Immediately after calling ModalDialog, SFPutFile calls your dlgHook
  8612. function, passing it the item number returned by ModalDialog and a
  8613. pointer to the dialog record describing your dialog box. Using these
  8614. two parameters, your dlgHook function should determine how to handle
  8615. the event. There are predefined constants for the item numbers of
  8616. standard enabled items, as follows:
  8617.  
  8618.       CONST putSave   = 1;   {Saver button}
  8619.             putCancel = 2;   {Cancel button}
  8620.         putEject  = 5;   {Eject button}
  8621.         putDrive  = 6;   {Drive button}
  8622.         putName   = 7;   {editText item for file name}
  8623.  
  8624.     ModalDialog also returns the "fake" item number 100 when a disk-
  8625. inserted event occurs, as detected by its filterProc function.
  8626.  
  8627.     After handling the event (or, perhaps, after ignoring it) the
  8628. dlgHook function must return an item number to SFPutFile. If the item
  8629. number is one of those listed above, SFPutFile responds in the standard
  8630. way; otherwise, it does nothing.
  8631.  
  8632. (note)
  8633.        For advanced programmers who want to change the
  8634.        appearance of the alerts displayed when an inappropriate
  8635.        file name is entered, the resource IDs of those alerts in
  8636.        the system resource file are listed below.
  8637.  
  8638.  
  8639.        Alert                   Resource ID
  8640.        Existing file             -3996
  8641.        Locked disk               -3997
  8642.        System error              -3995
  8643.        Disk not found            -3994
  8644. \ SFPPutFile
  8645. 13
  8646. PROCEDURE SFPPutFile (where: Point; prompt: SStr255; origNmae: Str255;
  8647.              dlgHook: ProcPtr; VAR reply: SFReply; dlgID: INTEGER;
  8648.          filterProc: ProcPtr);
  8649.  
  8650.     SFPPutFile is an alternative to SFPutFile for advanced programmers
  8651. who want to use a nonstandard dialog box. It's the same as SFPutFile
  8652. except for the two additional parameters dlgID and filterProc.
  8653.  
  8654.     DlgID is the resource ID of the dialog template to be used instead
  8655. of the standard one (so you can use whatever ID you wish rather than the
  8656. same one as the standard).
  8657.  
  8658.     The filterProc parameter determines how ModalDialog will filter
  8659. events when called by SFPPutFile. If filterProc is NIL, ModalDialog
  8660. does the standard filtering that it does when called by SFPutFile;
  8661. otherwise, filterProoc should point to a function for ModalDialog to
  8662. execute afterdoing the standard filterilng. THe function must be the
  8663. same as one you'd pass directly to ModalDialog in its filterProc
  8664. parameter. (See the Dialog Manager manual for more information.)
  8665. \ SFGetFile
  8666. 13
  8667. PROCEDURE SFGetFile (where: Point; prompt: Str255; fileFilter: ProcPtr;
  8668.                     numTypes: INTEGER; typeList: SFTypeList;
  8669.                     dlgHook: ProcPtr; VAR reply: SFReply);
  8670.  
  8671.     SFGetFIle displays a dialog box listing the names of a specific
  8672. group of files from which the user can select one to be opened (as
  8673. during an Open command). It then repeatedly gets and handles events
  8674. until the user either confirms the command after choosing a file name or
  8675. aborts the command by clicking Cancel in the dialog. It reports the
  8676. user's reply by filling the fields of the reply record specified by the
  8677. reply parameter, as described above under "Using the Standard File
  8678. Package".
  8679.  
  8680.     The general appearance of the standard SFGetFile dialog box is shown
  8681. in Figure S-5. File names are sorted in order of the ASCII codes of
  8682. their characters, ignoring diacritical marks and mapping lowercase
  8683. characters to their uppercase equivalents. If there are more file names
  8684. than can be displayed at one time, the scroll bar is active; otherwise,
  8685. the scroll bar is inactive.
  8686.  
  8687.     The where parameter specifies the  location of the top left corner
  8688. of the dialog box in global coordinates. The prompt parameter is
  8689. ignored; it's there for historical purposes only.
  8690.  
  8691.     The fileFilter, numTypes, and typeList parameters determine which
  8692. files appear in the dialog box. SFGetFile first looks at numTypes and
  8693. typeList to determine what types of files to display, then it executes
  8694. the function pointed to by fileFilter (if any) to do additional
  8695. filtering on which files to display. File types are discussed in the
  8696. manual THE STRUCTURE OF A MACINTOSH APPLICATION. For example, if the
  8697. applicaiton is concerned only with pictures, you won't want to display
  8698. the names of any text files.
  8699.  
  8700.     Pass -1 for numTypes to display all types of files; otherwise, pass
  8701. the number of file types you want to display, and pas the types
  8702. themselves in typeList. The SFTypeList data type is defined as follows:
  8703.  
  8704.          TYPE SFTypeList = ARRAY [0..3] OF OSTYPE;
  8705.  
  8706. (note)
  8707.        This array is declared for a reasonable maximum number of
  8708.        types (four). If you need to specify more than four
  8709.        types, declare your own array type with the desired
  8710.        number of entries (and use the @ operator to pass a
  8711.        pointer to it).
  8712.  
  8713.     If fileFilter isn't NIL, SFGetFile executes the function it points
  8714. to for each file, to determine whether the file should be displayed.
  8715. The fileFilter function has one parameter and returns a Boolean value.
  8716. For example:
  8717.  
  8718.          FUNCTION MyFileFilter (paramBlock: ParmBlkPtr) : BOOLEAN;
  8719.  
  8720.     SFGetFile passes this function the file information it gets by
  8721. calling the File Manager procedure PBGetFInfo. The function selects
  8722. which files should appear in the dialog by returning FALSE for every
  8723. file that should be shown and TRUE for every file that shouldn't be
  8724. shown.
  8725.  
  8726. (note)
  8727.        As described in the File Manager manual, a flag can be
  8728.        set that tells the Finder not to display a particular
  8729.        file's icon on the desktop; this has no effect on whether
  8730.        SFGetFile will list the file name.
  8731.  
  8732.     If you want to use the standard SFGetFile dialog box, pass NIL for
  8733. dlgHook; otherwise, see the information for advanced programmers below.
  8734.  
  8735.     Like SFPutFile, SFGetFile repeatedly calls the Dialog Manager
  8736. procedure ModalDialog. When an event involving an enabled dialog item
  8737. occurs, ModalDialog handles the event and returns the item number, and
  8738. SFGetFile responds as follows:
  8739.  
  8740.    - If the Eject or Drive button is clicked, or a disk is inserted,
  8741.      SFGetFile responds as described above under "About the Standard
  8742.      File Package".
  8743.  
  8744.    - If clicking or dragging occurs in the scroll bar, the contents of
  8745.      the dialog box are redrawn accordingly.
  8746.  
  8747.    - If a file name is clicked, it's selected and stored in the fName
  8748.      field of the reply record. (SFGetFile keeps track of whether a
  8749.      file name is currently selected, and makes the Open button
  8750.      inactive if not.)
  8751.  
  8752.    - If the Open button is clickd, SFGetFile returns control to the
  8753.      application with the first field of the reply record set to TRUE.
  8754.  
  8755.    - If a file name is double-clicked, SFGetFile responds as if the
  8756.      user clicked the file name and then the Open button.
  8757.  
  8758.    - If the Cancel button in the dialog is clicked, SFGetFile returns
  8759.      control to the application with the first field of the reply
  8760.      record set to FALSE.
  8761.  
  8762.     If a key (other than a modifier key) is pressed, SFGetFile selects
  8763. the first file name starting with the character typed. If no file name
  8764. starts with that character, it selects the first file name starting
  8765. with a character whose ASCII code is greater than the character typed.
  8766.  
  8767. Advanced programmers:  You can create your own dialog box rather than
  8768. use the  standard SFGetFile dialog. To do this, you must provide your
  8769. own dialog template and store it in your application's resource file
  8770. with the same resource ID that the standard template has in the system
  8771. resource file:
  8772.  
  8773.         CONST getDlgID = -4000;   {SFGetFile dialog template ID}
  8774.  
  8775. (note)
  8776.       THe SFPGetFile procedure, described below, lets you use
  8777.       any resource ID for your nonstandard dialog box.
  8778.  
  8779.  
  8780.     Your dialog template must specify that the dialog window be
  8781. invisible, and your dialog must contain all the standard items, as
  8782. listed below. The appearance and location of these items in your dialog
  8783. may be different. You can make an item "invisible" by giving it a
  8784. display rectangle that's off the screen. The display rectangle for each
  8785. in the standard dialog box is given below. THe rectangle for the
  8786. standard dialog box itself is (0,0,348,136).
  8787.  
  8788.  Item Number    Item                     Standard display rectangle
  8789.     1         Open button                     (152,28,232,46)
  8790.     2         Invisible button                (1152,59,1232,77)
  8791.     3         Cancel button                   (152,90,232,108)
  8792.     4         UserItem for disk name          (248,28,344,46)
  8793.     5         Eject button                    (256,59,336,77)
  8794.     6         Drive button                    (256,90,336,108)
  8795.     7         UserItem for file name list     (12,11,125,125)
  8796.     8         UserItem for scroll bar         (124,11,140,125)
  8797.     9         UserItem for gray line          (244,20,245,116)
  8798.    10         Invisible text (statText)       (1044,20,1145,116)
  8799.  
  8800.     If your dialog has additional items beyond the standard ones, or if
  8801. you want to handle any of the standard items in a nonstandard manner,
  8802. you must write your own dlgHook function and point to it with dlgHook.
  8803. Your dlgHook function should have two parameters and return an integer
  8804. value. For example, this is how it would be declared if it were named
  8805. MyDlg:
  8806.  
  8807.        FUNCTION MyDlg (item: INTEGER; theDialog: DialogPtr) : INTEGER;
  8808.  
  8809.     Immediately after calling ModalDialog, SFGetFile calls you dlgHook
  8810. function, passing it the item number returned by ModalDialog and a
  8811. pointer to the dialog record describing you dialog box. Using these
  8812. two parameters, your dlgHook function should determine how to handle
  8813. the event. There are predefined constants for the item numbers of
  8814. standard enabled items, as follows:
  8815.  
  8816.     CONST getOpen    = 1;   {Open button}
  8817.           getCancel  = 3;   {Cancel button}
  8818.       getEject   = 5;   {Eject button}
  8819.       getDrive   = 6;   {Drive button}
  8820.       getNmList  = 7;   {userItem for file name list}
  8821.       getScroll  = 8;   {userItem for scroll bar}
  8822.  
  8823.     ModalDIalog also returns "fake" item numbers in the following
  8824. situations, which are detected by its filterProc function:
  8825.  
  8826.    - When a disk-inserted event occurs, it returns 100.
  8827.  
  8828.    - When a key-down event occurs, it returns 1000 plus the ASCII code
  8829.      of the character.
  8830.  
  8831.     After handling the event (or, perhaps, after ignoring it) your
  8832. dlgHook function must return an item number to SFGetFile. If the item
  8833. number is one of those listed above, SFGetFile responds in the standard
  8834. way; otherwise, it does nothing.
  8835. \ SFPGetFile
  8836. 13
  8837. PROCEDURE SFPGetFile (where: Point; prompt: Str255; fileFilter:
  8838.             ProcPtr; numTypes: INTEGER; typeList: SFTypeList; dlgHook:
  8839.         ProcPtr; VAR reply: SFReply; dlgID: INTEGER; filterProc:
  8840.         ProcPtr);
  8841.  
  8842.     SFPGetFile is an alternative to SFGetFile for advanced programmers
  8843. who want to use a nonstandard dialog box. It's the same as  SFGetFile
  8844. except for the two additional parameters dlgID and filterProc.
  8845.  
  8846.     DlgID is the rexource ID of the dialog template to be used instead
  8847. of the standard one (so you can use whatever ID you wish rather than the
  8848. smae one as the standard).
  8849.  
  8850.     The filterProc parameter determines how ModalDialog will filter
  8851. events when called by SFPGetFile. If filterProc is NIL, ModalDialog
  8852. does the standard filtering that it does when called by SFGetFile;
  8853. otherwise, filterProc should point to a function for ModalDialog to
  8854. execute after doing the standard filtering. Note, however, that the
  8855. standard filtering will detect key-down events only if the dialog
  8856. template ID is the standard one.
  8857. \ DILoad
  8858. 13
  8859. PROCEDURE DILoad;
  8860.  
  8861.     DILoad reads the Disk Initialization Package, and its associated
  8862. dialog and dialog items, from the system resource file into memory and
  8863. makes them unpurgeaable.
  8864.  
  8865. (note)
  8866.        DIFormat, DIVerify, and DIZero don't need the dialog, so
  8867.        if you use only these routines you can call the Resource
  8868.        Manager function GetResource to read just the package
  8869.        resource into memory (and the Memory Manager procedure
  8870.        HNoPurge to make it unpurgeable).
  8871. \ DIUnload
  8872. 13
  8873. PROCEDURE DIUnload;
  8874.  
  8875.     DIUnload makes the Disk Initialization Package (and its associated
  8876. dialog an dialog items) purgeable.
  8877. \ DIBadMount
  8878. 13
  8879. FUNCTION DIBadMount (where: Point; evtMessage: LongInt) : INTEGER;
  8880.  
  8881.     Call DIBadMount when a disk-inserted event occurs if the result code
  8882. in the high-order word of the associated event message indicates an
  8883. error (that is, the result code is other than noErr). Given the event
  8884. message in evtMessage, DIBadMount evaluates the result code and either
  8885. ejects the disk or lets the user initialize and name it. The low-order
  8886. word of the event message contains the drive number. The where
  8887. parameter specifies the location (in global coordinates) of the top
  8888. left corner of the dialog box displayed by DIBadMount.
  8889.  
  8890.     If the result code passed is extFSErr, mFulErr, nsDrvErr, paramErr
  8891. , or volOnLinErr, DIBadMount displays a dialog box that describes the
  8892. problem and asks whether the user wants to initialized the disk. For
  8893. the result code ioErr, the dialog box shown in Figure D-1 is displayed.
  8894. (This happens if the disk is brand new.)  For badMDBErr and noMacDskErr,
  8895. DIBadMount displays a similar dialog box in which the description of
  8896. the problem is "This disk is damaged" and "This is not a Macintosh
  8897. disk", respectively.
  8898.  
  8899. (note)
  8900.        Before presenting the disk initialization dialog,
  8901.        DIBadMount checks whether the drive contains an already
  8902.        mounted volume; if so, it ejects the disk and returns 2
  8903.        as its result. This will happen rarely and may reflect
  8904.        an error in your program (for example, you forgot to call
  8905.        DILoad and the user had to switch to the disk containing
  8906.        the system resource file).
  8907.  
  8908.     If the user responds to the disk initialization dialog by clicking
  8909. the Eject button, DIBadMount ejects the disk and returns 1 as its result
  8910. If the Initialize button is clicked, a box displaying the message
  8911. "Initializing disk..." appears, and DIBadMount attempts to initialize
  8912. the disk. If initialization fails, the disk is ejected and the user is
  8913. informed as shown in Figure D-2; after the user clicks OK, DIBadMount
  8914. returns a negative result code ranging from firstDskErr to lastDskErr,
  8915. indicating that a low-level disk error occurred.
  8916.  
  8917.     If the disk is successfully initialized, the dialog box in Figure D
  8918. appears. After the user names the disk and clicks OK, DIBadMount
  8919. mounts the volume by calling the File Manager function PBMountVol and
  8920. returns PBMountVol's result code (noErr if no error occurs).
  8921.  
  8922.       Result codes
  8923.       ------------
  8924.       noErr                No error
  8925.       extFSErr             External file system
  8926.       mFulErr              Memory full
  8927.       nsDrvErr             No such drive
  8928.       paramErr             Bad drive number
  8929.       volOnLinErr          Volume already on-line
  8930.       firstDskErr          Low-level disk error
  8931.       through lastDskErr
  8932.  
  8933.       Other results
  8934.       -------------
  8935.       1                    User clicked Eject
  8936.       2                    Mounted volume in drive
  8937. \ DIFormat
  8938. 13
  8939. FUNCTION DIFormat (drvNum: INTEGER) : OSErr;
  8940.  
  8941.     DILFormat formats the disk in the drive specified by the given drive
  8942. number and returns a result code indicating whether the formatting was
  8943. completed successfully or failed. Formatting a disk consists of
  8944. writing special infromation onto it so that the Disk Driver can read
  8945. from and write to the disk.
  8946.  
  8947.       Result codes
  8948.       ------------
  8949.       noErr               No error
  8950.       firstDskErr         Low-level disk error
  8951. \ DIVerify
  8952. 13
  8953. FUNCTION DIVerify (drvNum: INTEGER) : OSErr;
  8954.  
  8955.     DIVerify verifies the format of the disk in the drive specified by
  8956. the given drive number; it reads each bit from the disk and returns a
  8957. result code indicating whether all bits were read successfully or not.
  8958.  
  8959.       Result codes
  8960.       ------------
  8961.       noErr                 No error
  8962.       firstDskErr           Low-level disk error
  8963. \ DIZero
  8964. 13
  8965. FUNCTION DIZero (drvNum: INTEGER; volName: Str255) : OSErr;
  8966.  
  8967.     On the unmounted volume in the drive specified by the given drive
  8968. number, DIZero writes the volume information, a block map, and a file
  8969. directory as for a volume with no files; the volName parameter
  8970. specifies the volume name to be included in the volume information.
  8971. This is the last step in initialization (after formatting and
  8972. verifying) and makes any files that are already on the volume
  8973. permanently inaccessible. If the operation fails, DIZero returns a
  8974. result code indicating that a low-level disk error occurred; otherwise,
  8975. it mounts the volume by calling the File Manager function PBMountVol
  8976. and returns PBMountVol's result code (noEr if no error occurs).
  8977.  
  8978.  
  8979.       Result codes
  8980.       ------------
  8981.       noErr                    No error
  8982.       badMDBErr                Bad master directory block
  8983.       extFSErr                 External file system
  8984.       ioErr                    Disk I/O error
  8985.       mFulErr                  Memory full
  8986.       noMacDskErr              Not a Macintosh volume
  8987.       nsDrvErr                 No such drive
  8988.       paramErr                 Bad drive number
  8989.       volOnLinErr              Volume already on-line
  8990.       firstDskErr              Low-level disk error
  8991.       through lastDskErr
  8992. \ InitApplZone
  8993. 14
  8994. PROCEDURE InitApplZone;
  8995.  
  8996.       _________________________________________________________
  8997.  
  8998.       Trap macro            _InitApplZone
  8999.       On exit               D0:  result code (integer)
  9000.  
  9001.       _________________________________________________________
  9002.  
  9003.  
  9004.     InitApplZone initializes the application heap zone and makes it the
  9005. current zone. The contents of any previous application zone are lost;
  9006. all previously existing blocks in that zone are discarded.
  9007. InitApplZone is called by the Segment Loader when starting up an
  9008. application;  you shouldn't normally need to call it.
  9009.  
  9010. (warning)
  9011.        Reinitializing the application zone from within a running
  9012.        program is tricky, since the program's code itself
  9013.        resides in the application zone. To do it safely, the
  9014.        code containing the InitApplZone call cannot be in the
  9015.        application zone.
  9016.  
  9017.     The application zone has an initial size of 6K bytes, and can be
  9018. expanded as needed in 1K increments. Space is initially allocated for
  9019. 64 master pointers; should more be needed later, they will be added 64
  9020. at a time. The zone's grow zone function is set to NIL.
  9021.  
  9022.        Result codes        noErr         No eror
  9023. \ SetApplBase
  9024. 14
  9025. PROCEDURE SetApplBase (startPtr: Ptr);
  9026.  
  9027.             _________________________________________________
  9028.  
  9029.      Trap macro               _SetApplBase
  9030.      On entry                 A0:  startPtr (pointer)
  9031.      On exit                  D0:  result code (integer)
  9032.  
  9033.             _________________________________________________
  9034.  
  9035.  
  9036.     SetApplBase changes the starting address of the application heap
  9037. zone to the address designated by startPtr, and then calls IniApplZone.
  9038. SetApplBase is normally called only by the system itself; you should
  9039. never need to call this procedure.
  9040.  
  9041.     Since the application heap zone begins immediately folowing the end
  9042. of the system zone, changingits starting address has the effect of
  9043. changing the size of the system zone. The system zone can be made
  9044. larger, but never smaller; if startPtr points to an address lower than
  9045. the current end of the system zone, it's ignored and the application
  9046. zone's starting address is left unchanged.
  9047.  
  9048. (warning)
  9049.       Like InitApplZone, SetApplBase is a tricky operation,
  9050.       because the code of the program itself resides in the
  9051.       application heap zone. To do it safely, the code
  9052.       containing the SetApplBase call cannot be in the
  9053.       application zone.
  9054.  
  9055.       Result codes     noErr             No error
  9056. \ InitZone
  9057. 14
  9058. PROCEDURE InitZone (pGrowZone: ProcPtr; cMoreMasters: INTEGER;
  9059.                     limitPtr, startPtr: Ptr);
  9060.  
  9061.  
  9062.        ________________________________________________________
  9063.  
  9064.         Trap macro            _InitZone
  9065.  
  9066.         On entry              A0:  pointer to parameter block
  9067.  
  9068.         Parameter block
  9069.                0      startPtr       pointer
  9070.                4      limitPtr       pointer
  9071.                8      cMoreMasters   integer
  9072.               10      pGrowZone      pointer
  9073.  
  9074.         On exit                D0: result code (integer)
  9075.  
  9076.        ________________________________________________________
  9077.  
  9078.  
  9079.     InitZone creates a new heap zone initializes its header and trailer,
  9080. and makes it the current zone. The startPtr parameter is a pointer to
  9081. the first byte of the new zone; limitPtr points to the first byte of
  9082. the zone trailer. The new zone will occupy memory addresses from
  9083. ORD(startPtr) to ORD(limitPtr)+11.
  9084.  
  9085.     CMoreMasters tells how many master pointers should be allocated at a
  9086. time for the new zone. This number of master pointers are created
  9087. initially; should more be needed later, they will be added in
  9088. increments of this same number. For the system heap zone, this number
  9089. is initially 32; for the application heap zone, it's 64.
  9090.  
  9091.     The pGrowZone parameter is a pointer to the grow zone function for
  9092. the new zone, if any. If you're not defining a grow zone function for
  9093. this zone, pass NIL.
  9094.  
  9095.     The new zone includes a 52-byte header, so its actual usable space
  9096. runs from ORD(startPtr)+52 through ORD(limitPtr)-1. In addition, each
  9097. master pointer occupies four bytes within this usable area. Thus the
  9098. total available space in the zone, in bytes, is initially
  9099.  
  9100.       ORD(limitPtr) - ORD(startPtr) - 52 - 4*cMoreMasters
  9101.  
  9102.     This number must not be less than 0. Note that the amount of
  9103. available space in the zone will decrease as more master pointers are
  9104. allocated.
  9105.  
  9106.       Result codes        noErr                No error
  9107. \ SetApplLimit
  9108. 14
  9109. PROCEDURE SetApplLimit (zoneLimit: Ptr);
  9110.  
  9111.         _________________________________________________
  9112.  
  9113.          Trap macro        _SetApplLimit
  9114.  
  9115.          On entry          A0:  zoneLimit (pointer)
  9116.  
  9117.          On exit           D0:  result code (integer)
  9118.  
  9119.         _________________________________________________
  9120.  
  9121.  
  9122.     SetApplLimit sets the application heap limit, beyond which the
  9123. application heap zone can't be expanded. The actual expansion isn't
  9124. under your program's control, but is done automatically by the Memory
  9125. Manager when necessary to satisfy allocation requests. Only the
  9126. original application zone can be expanded.
  9127.  
  9128.     ZoneLimit  is a limit pointer to a byte in memory beyond which the
  9129. zone will not be allowed to grow. The zone can grow to include the byte
  9130. preceding zoneLimit in memory, but no farther. If the zone already
  9131. extends beyond the specified limit it won't be cut back, but it will be
  9132. prevented from growing any more.
  9133.  
  9134. (warning)
  9135.        Notice that zoneLimit is not a byte count. To limit the
  9136.        application zone to a particular size (say 8Kbytes), you
  9137.        have to write something like
  9138.  
  9139.             SetApplLimit(Ptr(ApplicZone)+8192)
  9140.  
  9141.        The Memory Manager function ApplicZone is explained
  9142.        below.
  9143.  
  9144.  
  9145.             _________________________________________________
  9146.  
  9147.        Assembly-language note:  The global variable ApplLimit contains
  9148.        the application heap limit.
  9149.  
  9150.             _________________________________________________
  9151.  
  9152.  
  9153.        Result codes      noErr           No error
  9154. \ MaxApplZone
  9155. 14
  9156. PROCEDURE MaxApplZone;    [No trap macro]
  9157.  
  9158.     MaxApplZone expands the application heap zone to the application
  9159. heap limit without purging any blocks currently in the zone. If the
  9160. zone already extends to the limit, it won't be changed.
  9161.  
  9162.       Result codes      noErr           No error
  9163. \ MoreMasters
  9164. 14
  9165. PROCEDURE MoreMasters;
  9166.  
  9167.             _________________________________________________
  9168.  
  9169.        Trap macro         _MoreMasters
  9170.  
  9171.             _________________________________________________
  9172.  
  9173.     MoreMasters allocates another block of master pointers in the
  9174. current heap zone. This procedure is usually called very early in an
  9175. application.
  9176.  
  9177.      Result codes
  9178.      ------------
  9179.      noErr             No error
  9180.      memFullErr        Not enough room in zone
  9181. \ GetZone
  9182. 14
  9183. FUNCTION GetZone:  THz;
  9184.  
  9185.             _________________________________________________
  9186.  
  9187.       Trap macro             _GetZone
  9188.  
  9189.       On exit                A0:  function result (pointer)
  9190.                              D0:  result code (integer)
  9191.             _________________________________________________
  9192.  
  9193.     GetZone returns a pointer to the curent heap zone.
  9194.  
  9195.             _________________________________________________
  9196.  
  9197.       Assembly-language note:  The global variable TheZone contains a
  9198.       pointer to the current heap zone.
  9199.             _________________________________________________
  9200.  
  9201.       Result codes      noErr          No error
  9202. \ SetZone
  9203. 14
  9204. PROCEDURE SetZone (hz: THz);
  9205.  
  9206.             _________________________________________________
  9207.  
  9208.        Trap macro      _SetZone
  9209.  
  9210.        On entry        A0:  hz (pointer)
  9211.  
  9212.        On exit         D0:  result code (integer)
  9213.             _________________________________________________
  9214.  
  9215.     SetZone sets the current heap zone to the zone pointed to by hz.
  9216.  
  9217.             _________________________________________________
  9218.  
  9219.        Assembly-language note:  You can set the current heap zone by
  9220.        storing a pointer to it in the global variable TheZone.
  9221.             _________________________________________________
  9222.  
  9223.        Result codes          noErr           No error
  9224.  
  9225.  
  9226.  
  9227. \ SystemZone
  9228. 14
  9229. FUNCTION SystemZone : THz;       [No trap macro]
  9230.  
  9231.     SystemZone returns a pointer to the system heap zone.
  9232.  
  9233.             _________________________________________________
  9234.  
  9235.        Assembly-language note:  The global variable SysZone contains a
  9236.        pointer to the system heap zone.
  9237.             _________________________________________________
  9238.  
  9239.        Result codes            noErr        No error
  9240. \ ApplicZone
  9241. 14
  9242. PROCEDURE ApplicZone : THz;  [No trap macro]
  9243.  
  9244.     ApplicZone returns a pointer to the original application heap zone.
  9245.  
  9246.             _________________________________________________
  9247.  
  9248.      Assembly-language note:  The global variable ApplZone contains a
  9249.      pointer to the original application heap zone.
  9250.             _________________________________________________
  9251.  
  9252.      Result codes         noErr          No error
  9253. \ NewHandle
  9254. 14
  9255. FUNCTION NewHandle (logicalSize: Size) : Handle;
  9256.  
  9257.     __________________________________________________________
  9258.  
  9259. Trap macro       _NewHandle
  9260.                  _NewHandle ,SYS           (applies to system heap)
  9261.                  _NewHandle ,CLEAR         (clears allocated block)
  9262.                  _NewHandle ,SYS,CLEAR     (applies to system heap and
  9263.                                             clears allocated block)
  9264.  
  9265. On entry         D0:  logicalSize (long integer)
  9266.  
  9267. On exit          A0:  function result (handle)
  9268.                  D0:  result code (integer)
  9269.     __________________________________________________________
  9270.  
  9271.     NewHandle attempts to allocate a new relocatable block of
  9272. logicalSize bytes from the current heap zone and then return a handle to
  9273. it. The new block will be unlocked and unpurgeable. If logicalSize bytes
  9274. can't be allocated, NewHandle returns NIL.
  9275.  
  9276.     NewHandle will pursue all available avenues to create a free block
  9277. of the requested size, includinig compacting the heap zone, increasing
  9278. its size, purging blocks from it, and calling its grow zone function, if
  9279. any.
  9280.  
  9281.        Result codes     noErr           No error
  9282.                         memFulErr       Not enough room in zone
  9283. \ DisposHandle
  9284. 14
  9285. PROCEDURE DisposHandle (h: Handle);
  9286.  
  9287.             _________________________________________________
  9288.  
  9289.       Trap macro           _DisposHandle
  9290.  
  9291.       On entry             A0:  h (handle
  9292.  
  9293.       On exit              A0:  0
  9294.                            D0: result code (integer)
  9295.             _________________________________________________
  9296.  
  9297.     DisposHandle releases the memory occupied by the relocatable block
  9298. whose handle is h.
  9299.  
  9300. (warning)
  9301.        After a call to DisposHandle, all handles to the released
  9302.        block become invalid and should not be used again.
  9303.  
  9304.        Result codes     noErr       No error
  9305.                         memWZErr    Attempt to operate on a free block
  9306. \ GetHandleSize
  9307. 14
  9308. FUNCTION GetHandleSize (h: Handle) : Size;
  9309.  
  9310.             _________________________________________________
  9311.  
  9312.      Trap macro      _GetHandleSize
  9313.  
  9314.      On entry        A0:  h (handle)
  9315.  
  9316.      On exit         D0:  if >=0, function result (long integer)
  9317.                           if <0, result code (integer)
  9318.             _________________________________________________
  9319.  
  9320.     GetHandleSize returns the logical size, in bytes, of the relocatable
  9321. block whose handle is h. In case of an error, GetHandleSize returns 0.
  9322.  
  9323.             _________________________________________________
  9324.  
  9325.      Assembly-language note:  Recall that the trap dispatcher sets
  9326.      the condition codes before returning from a trap by testing the
  9327.      low-order word of register D0 with a TST.W instruction. Since
  9328.      the block size returned in D0 by _GetHandleSize is a full 32-bit
  9329.      long word, the word-length test sets the condition codes
  9330.      incorrectly in this case. To branch on the contents of D0, use
  9331.      your own TST.L instruction on return from the trap to test the
  9332.      full 32 bits of the register.
  9333.             _________________________________________________
  9334.  
  9335.      Result codes    noErr           No error   [Pascal only]
  9336.                     nilHandleErr     NIL master pointer
  9337.                     memWZErr         Attempt to operate on a free block
  9338. \ SetHandleSize
  9339. 14
  9340. PROCEDURE SetHandleSize (h: Handle; newSize: Size);
  9341.  
  9342.             _________________________________________________
  9343.  
  9344.      Trap macro          _SetHandleSize
  9345.  
  9346.      On entry       A0:  h (handle)
  9347.                     D0:  newSize (long integer)
  9348.  
  9349.      On exit        D0:  result code (integer)
  9350.             _________________________________________________
  9351.  
  9352.     SetHandleSize changes the logical size of the relocatable block
  9353. whose handle is h to newSize bytes.
  9354.  
  9355. (note)
  9356.        Don't attempt to increase the size of a locked block,
  9357.        becausse its unlikely the Memory Manager will be able to
  9358.        do so.
  9359.  
  9360.        Result codes
  9361.  
  9362.        noErr         No error
  9363.        memFullErr    Not enough room to grow
  9364.        nilHandleErr  NIL master pointer
  9365.        memWZErr      Attempt to operate on a free block
  9366. \ HandleZone
  9367. 14
  9368. FUNCTION HandleZone (h: Handle) : THz;
  9369.  
  9370.         _________________________________________________
  9371.  
  9372.           Trap macro    _HandleZone
  9373.  
  9374.           On entry      A0: h (handle)
  9375.  
  9376.           On exit       A0:  function result (pointer)
  9377.                         D0:  result code (integer)
  9378.         _________________________________________________
  9379.  
  9380.     HandleZone returns a pointer to the heap zone containing the
  9381. relocatable block whose handle is h.
  9382.  
  9383. (warning)
  9384.         If handle h is empty (points to a NIL master pointer),
  9385.     HandleZone returns a pointer to the current heap zone.
  9386.     In case of an error, the result returned by HandleZone is
  9387.     meaningless and should be ignored.
  9388.  
  9389. Result codes      noErr            No error
  9390.                   memWZErr         Attempt to operate on a free block
  9391. \ RecoverHandle
  9392. 14
  9393. FUNCTION RecoverHandle (p:Ptr) : Handle;
  9394.  
  9395.             _________________________________________________
  9396.  
  9397.       Trap macro      _RecoverHandle
  9398.                       _RecoverHandle ,SYS     (applies to system heap)
  9399.  
  9400.       On entry        A0:  p (pointer)
  9401.  
  9402.       On exit         A0:  function result (handle)
  9403.                       D0:  unchanged
  9404.             _________________________________________________
  9405.  
  9406.  
  9407.     RecoverHandle returns a handle to the relocataable block pointed to
  9408. by p.
  9409.  
  9410.             _________________________________________________
  9411.  
  9412.     Assembly-language note:  The trap _RecoverHandle doesn't return
  9413.     a result code in register D0; the previous contents of D0 are
  9414.     preserved unchanged.
  9415.             _________________________________________________
  9416.  
  9417.     Result codes     noErr          No error   [Pascal only]
  9418. \ ReallocHandle
  9419. 14
  9420. PROCEDURE ReallocHandle (h: Handle; logicalSize: Size);
  9421.  
  9422.             _________________________________________________
  9423.  
  9424.     Trap macro         _ReallocHandle
  9425.  
  9426.     On entry           A0:  h (handle)
  9427.                        D0:  logicalSize   (integer)
  9428.  
  9429.     On exit            A0:  original h or 0
  9430.                        D0:  result code  (integer)
  9431.             _________________________________________________
  9432.  
  9433.     ReallocHandle allocates a new relocatable block with a logical size
  9434. of logicalSize bytes. It then updates handle h by setting its master
  9435. pointer to point to the new block. The main use of this procedure is
  9436. to reallocate space for a block that has been purged. Normally h is an
  9437. empty handle, but it need not be:  if it points to an existing block,
  9438. that block is released before the new block is created.
  9439.  
  9440.     In case of an error, no new block is allocated and handle h is left
  9441. unchanged.
  9442.  
  9443.             _________________________________________________
  9444.  
  9445.     Assembly-language note:  On return from ReallocHandle, register
  9446.     A0 contains the original handle h, or 0 if no room could be
  9447.     found for the requested block.
  9448.             _________________________________________________
  9449.  
  9450.     Result codes
  9451.  
  9452.             noErr       Noerror
  9453.             memFullErr  Not enough room in zone
  9454.             memWZErr    Attempt to operate on a free block
  9455.             MemPurErr   Block is locked
  9456. \ NewPtr
  9457. 14
  9458. FUNCTION NewPtr (logicalSize: Size) : Ptr;
  9459.  
  9460.             _________________________________________________
  9461.  
  9462.     Trap macro  _NewPtr
  9463.                 _NewPtr ,SYS        (applies to system heap)
  9464.                 _NewPtr ,CLEAR      (clears allocated block)
  9465.                 _NewPtr ,SYS,CLEAR  (applies to system heap and
  9466.                                     clears allocated block)
  9467.  
  9468.     On entry    D0:  logicalSize (long integer)
  9469.  
  9470.     On exit     A0:  function result (pointer)
  9471.                 D0:  result code (integer)
  9472.             _________________________________________________
  9473.  
  9474.     NewPtr attempts to allocate a new nonrelocatable block of
  9475. logicalSize bytes from the current heap zone and then return a pointer
  9476. to it. If logicalSize bytes can't be allocated, NewPtr returns NIL.
  9477.  
  9478.     Newptr will pursue all available avenues to create a free block of
  9479. the requested size, including compacting the heap zone, increasing its
  9480. size, purging blocks from it, and calling its grow zone function, if
  9481. any.
  9482.  
  9483.     Result codes
  9484.  
  9485.             noErr       No error
  9486.             memFullErr  Not enough room in zone
  9487. \ DisposPtr
  9488. 14
  9489. PROCEDURE DisposPtr (p: Ptr);
  9490.  
  9491.           _________________________________________________
  9492.  
  9493.             Trap macro  _DisposPtr
  9494.  
  9495.             On entry    A0:  p (pointer)
  9496.  
  9497.             On exit     A0:  0
  9498.                         D0:  result code (integer)
  9499.           _________________________________________________
  9500.  
  9501.     DisposPtr releases the memory occupied by the nonrelocatable block
  9502. pointed to by p.
  9503.  
  9504. (warning)
  9505.     After a call to DisposPtr, all pointers to the released
  9506.     block become invalid and should not be used again.
  9507.  
  9508.     Result codes
  9509.  
  9510.             noErr       No error
  9511.             memWZErr    Attempt to operated on a free block
  9512. \ GetPtrSize
  9513. 14
  9514. FUNCTION GetPtrSize (p: Ptr) : Size;
  9515.  
  9516.     ___________________________________________________________
  9517.  
  9518.     Trap macro  _GetPtrSize
  9519.  
  9520.     On entry    A0:  p (pointer)
  9521.  
  9522.     On exit     D0:  if >=0, function result (long integer)
  9523.                      if <0, result code (integer)
  9524.     ___________________________________________________________
  9525.  
  9526.     GetPtrSize returns the logical size, in bytes, of the nonrelocatable
  9527. block pointed to by p. In case of an error, GetPtrSize returns 0.
  9528.  
  9529.     ___________________________________________________________
  9530.  
  9531.     Assembly-language note:  Recall that the trap dispatcher sets
  9532.     the condition codes before returning from a trap by testing the
  9533.     low-order half of register D0 with a TST.W instruction. Since
  9534.     the block size returned in D0 by _GetPtrSize is a full 32-bit
  9535.     long word, the word-length test sets the condition codes
  9536.     incorrectly in this case. To branch on the contents of D0, use
  9537.     your own TST.L instruction on return from the trap to test the
  9538.     full 32 bits of the register.
  9539.     ___________________________________________________________
  9540.  
  9541.     Result codes
  9542.  
  9543.             noErr       No error   [Pascal only]
  9544.             memWZErr    Attempt to operate on a free block
  9545. \ SetPtrSize
  9546. 14
  9547. PROCEDURE SetPtrSize (p: Ptr; newSize: Size);
  9548.  
  9549.     ___________________________________________________________
  9550.  
  9551.     Trap macro  _SetPtrSize
  9552.  
  9553.     On entry    A0:  p (pointer)
  9554.  
  9555.     On exit     A0:  function result (pointer)
  9556.             D0:  result code (integer)
  9557.     ___________________________________________________________
  9558.  
  9559.     PtrZone returns a pointer to the heap zone containing the
  9560. nonrelocatable block pointed to by p. In case of an error, the result
  9561. returned by PtrZone is meaningless and should be ignored.
  9562.  
  9563.     Result codes
  9564.  
  9565.             noErr       No error
  9566.             memWZErr    Attempt to operate on a free block
  9567. \ FreeMem
  9568. 14
  9569. FUNCTION FreeMem : LONGINT;
  9570.  
  9571.         _______________________________________________________
  9572.  
  9573.         Trap macro  _FreeMem
  9574.                     _FreeMem ,SYS   (applies to system heap
  9575.  
  9576.         On exit     D0:  function result (long integer)
  9577.         _______________________________________________________
  9578.  
  9579.     FreeMem returns the total amount of free space in the current heap
  9580. zone, in bytes. Notice that it ususally isn't possible to allocate a 
  9581. block of this size, because of fragmentation due to nonrelocatable or
  9582. locked blocks.
  9583.  
  9584.     Result codes
  9585.  
  9586.             noErr   No error
  9587. \ MaxMem
  9588. 14
  9589. FUNCTION MaxMem (VAR grow: Size) : Size;
  9590.  
  9591.             _________________________________________________
  9592.  
  9593.     Trap macro  _MaxMem
  9594.                 _MaxMem ,SYS            (applies to system heap)
  9595.  
  9596.     On exit     D0:  function result    (long integer)
  9597.                 A0:  grow               (long integer)
  9598.             _________________________________________________
  9599.  
  9600.     MaxMem compacts the current heap zone and purges all purgeable
  9601. blocks from the zone. It returns as its result the size in bytes of the
  9602. largest contiguous free block in the zone after the compaction. If the
  9603. current zone is the original application heap zone, the variable
  9604. parameter grow is set to the maximum number of bytes by which the zone
  9605. can grow. For any other heap zone, grow is set to 0. MaxMem doesn't
  9606. actually expand the zone or call its grow zone function.
  9607.  
  9608.     Result codes
  9609.  
  9610.             noErr   No error
  9611. \ CompactMem
  9612. 14
  9613. FUNCTION CompactMem (cbNeeded: Size) : Size;
  9614.  
  9615.     ___________________________________________________________
  9616.  
  9617.     Trap macro  _CompactMem
  9618.                 _CompactMem ,SYS    (applies to system heap)
  9619.  
  9620.     On entry    D0:  cbNeeded (longinteger)
  9621.  
  9622.     On exit     D0:  function result (long integer)
  9623.     ___________________________________________________________
  9624.  
  9625.     CompactMem compacts the current heap zone by moving relocatable
  9626. blocks forward and collecting free space together until a contiguous
  9627. block of at least cbNeeded free bytes is found or the entire zone is
  9628. compacted; it doesn't purge any purgeable blocks. CompactMem returns
  9629. the size in bytes of the largest contiguous free block remaining. Note
  9630. that it doesn't actually allocate the block.
  9631.  
  9632. (notee)
  9633.     To force a compaction of the entire heap zone, pass
  9634.     maxSize for cbNeeded.
  9635.  
  9636.     Result codes
  9637.  
  9638.         noErr       No error
  9639. \ ResrvMem
  9640. 14
  9641. FUNCTION ResrvMem (cbNeeded: Size);
  9642.  
  9643.     ___________________________________________________________
  9644.  
  9645.     Trap macro  _ResrvMem
  9646.                 _ResrvMem ,SYS      (applies to system heap)
  9647.  
  9648.     On entry    D0:  cbNeeded (long integer)
  9649.  
  9650.     On exit     D0:  result code  (integer)
  9651.     ___________________________________________________________
  9652.  
  9653.     ResrvMem creates free space for a block of cbNeeded contiguous bytes
  9654. at the lowest possible position in the current heap zone. It will try
  9655. every available means to place the block as close as possible to the
  9656. beginnig of the zone, including moving other blocks upward, expanding
  9657. the zone, or purging blocks from it. Notice that ResrvMem doesn't
  9658. actually allocate the block.
  9659.  
  9660. (note)
  9661.     When you allocate a relocatable block that you know will
  9662.     be locked for long periods of time, call ResrvMem first.
  9663.     This reserves space for the block near the beginning of
  9664.     the heap zone, where it will interfere with compaction as
  9665.     little as possible. It isn't necessary to call ResrvMem
  9666.     for a nonrelocatable block; NewPtr calls it
  9667.     automatically.
  9668.  
  9669.     Result codes
  9670.  
  9671.             noErr       No error
  9672.             memFullErr  Not enough room in zone
  9673. \ PurgeMem
  9674. 14
  9675. PROCEDURE PurgeMem (cbNeeded: Size);
  9676.  
  9677.     ___________________________________________________________
  9678.  
  9679.     Trap macro  _PurgeMem
  9680.                 _PurgeMEM ,SYS  (applies to system heap)
  9681.  
  9682.     On entry    D0:  cbNeeded (long integer)
  9683.  
  9684.     On exit     D0:  result code (integer)
  9685.     ___________________________________________________________
  9686.  
  9687.     PurgeMem sequentially purges blocks from the current heap zone until
  9688. a contiguous block of at least cbNeeded free bytes is created or the
  9689. entire zone is purged; it doesn't compact the heap zone. Only
  9690. relocatable, unlocked, purgeable blocks can be purged. Notice that
  9691. PurgeMem doesn't actually allocate the block.
  9692.  
  9693. (note)
  9694.     To force a purge of the entire heap zone, pass maxSize
  9695.     for cbNeeded.
  9696.  
  9697.     Result codes
  9698.  
  9699.             noErr       No error
  9700.             memFullErr  Not enough room in zone
  9701. \ EmptyHandle
  9702. 14
  9703. PROCEDURE EmptyHandle (h: Handle);
  9704.  
  9705.     ___________________________________________________________
  9706.  
  9707.     TRap macro  _EmptyHandle
  9708.  
  9709.     On entry    A0:  h (handle)
  9710.  
  9711.     On exit     A0:  h (handle)
  9712.                 D0:  result code (integer)
  9713.     ___________________________________________________________
  9714.  
  9715.     EmptyHandle purges the relocatable block whose handle is h from its
  9716. heap zone and sets its master pointer to NIL (making it an empty
  9717. handle). If h is already empty, EmptyHandle does nothing.
  9718.  
  9719. (note)
  9720.     Since the space occupied by the block's master pointer
  9721.     itself remains allocated, all handles pointing to it
  9722.     remain valid but empty. When you later reallocate space
  9723.     for the block with ReallocHandle, the master pointer will
  9724.     be updated, causing all existing handles to point
  9725.     correctly to the new block.
  9726.  
  9727.     The block whose handle is h must be unlocked, but need not be
  9728. purgeable.
  9729.  
  9730.     Result codes
  9731.  
  9732.             noErr       No error
  9733.             memWZErr    Attempt to operate on a free block
  9734.             memPurErr   Block is locked
  9735. \ HLock
  9736. 14
  9737. PROCEDURE HLock (h: Handle);
  9738.  
  9739.     ___________________________________________________________
  9740.  
  9741.     Trap macro  _HLock
  9742.  
  9743.     On entry    A0:  h (handle)
  9744.  
  9745.     On exit     D0:  result code (integer)
  9746.     ___________________________________________________________
  9747.  
  9748.     HLock locks a relocatable block, preventing it from being moved
  9749. within its heap zone. If the block is already locked, HLock does
  9750. nothing.
  9751.  
  9752.     ___________________________________________________________
  9753.  
  9754.     Assembly-language note:  Changing the value of the block's
  9755.     master pointer's lock bit with a BSET instruction is faster than
  9756.     HLock. However, HLock may eventually perform additional tasks.
  9757.     ___________________________________________________________
  9758.  
  9759.     Result codes
  9760.  
  9761.             noErr       No error
  9762.             nilHandleErr    NIL master pointer
  9763.             memWZErr    Attempt to opetate on a free block
  9764. \ HUnlock
  9765. 14
  9766. PROCEDURE HUnlock (h: Handle);
  9767.  
  9768.     ___________________________________________________________
  9769.  
  9770.     Trap macro  _HUnlock
  9771.  
  9772.     On entry    A0:  h (handle)
  9773.  
  9774.     On exit     D0:  result code (integer)
  9775.     ___________________________________________________________
  9776.  
  9777.     HUnlock unlocks a relocatable block, allowing it to be moved within
  9778. its heap zone. If the block is already unlocked, HUnlock does nothing.
  9779.  
  9780.     ___________________________________________________________
  9781.  
  9782.     Assembly-language note:  Changing the value of the block's
  9783.     master pointer's lock bit with a BCLR instruction is faster than
  9784.     HUnlock. However, HUnlock may eventually perform additional
  9785.     tasks.
  9786.     ___________________________________________________________
  9787.  
  9788.     Result codes
  9789.  
  9790.             noErr           No error
  9791.             nilHandleErr    NIL master pointer
  9792.             memWZErr        Attempt to operate on a fre block
  9793. \ HPurge
  9794. 14
  9795. PROCEDURE HPurge (h: Handle);
  9796.  
  9797.     ___________________________________________________________
  9798.  
  9799.     Trap macro  _HPurge
  9800.  
  9801.     On entry    A0:  h (handle)
  9802.  
  9803.     On exit     D0:  result code (integer)
  9804.     ___________________________________________________________
  9805.  
  9806.     HPurge marks a relocatable block as purgeable. If the block is
  9807. already purgeable, HPurge does nothing.
  9808.  
  9809.     Result codes
  9810.  
  9811.             noErr       No error
  9812.             nilHandleErr    NIL master pointer
  9813.             memWZErr    Attempt to operate on a free block
  9814. \ HNoPurge
  9815. 14
  9816. PROCEDURE HNoPurge (h: Handle);
  9817.  
  9818.     ___________________________________________________________
  9819.     Trap macro  _HNoPurge
  9820.  
  9821.     On entry    A0:  h (handle)
  9822.  
  9823.     On exit     D0:  result code (integer)
  9824.     ___________________________________________________________
  9825.  
  9826.     HNoPurge marks a relocatable block as unpurgeable. If the block is
  9827. already unprugeable, HNoPurge does nothing.
  9828.  
  9829.     Result codes
  9830.  
  9831.             noErr           No error
  9832.             nilHandleErr    NIL master pointerr
  9833.             memWZErr        Attempt to operate on a free block
  9834. \ SetGrowZone
  9835. 14
  9836. PROCEDURE SetGrowZone (growZone: ProcPtr);
  9837.  
  9838.     ___________________________________________________________
  9839.  
  9840.     Trap macro  _SetGrowZone
  9841.  
  9842.     On entry    A0:  growZone (pointer)
  9843.  
  9844.     On exit     D0:  result code (integer)
  9845.     ___________________________________________________________
  9846.  
  9847.     SetGrowZone sets the current heap fzone's grow zone function as
  9848. designated by the growZone parameter. A NIL parameter value removes
  9849. any grow zone function the zone may previously have had.
  9850.  
  9851. (note)
  9852.     If yokur program presses the limits of the available heap
  9853.     space, it's a good idea to have a grow zone function of
  9854.     some sort. At the very least, the grow zone function
  9855.     should detect when the Memory Manager is about to run out
  9856.     of space at a critical time (see GZCritical, below) and
  9857.     take some graceful action--such as displaying an alert
  9858.     box with the message "Out of memory"--instead of just
  9859.     failing unpredictably.
  9860.  
  9861.     The Memory Manager calls the grow zone function as a last resort
  9862. when trying to allocate space, if it has failed to create a block of the
  9863. needed size after compacting the zone, increasing its size (in the case
  9864. of the origianal application zone), or purging blocks from it. Memory
  9865. Manager routines that may cause the grow zone function to be called are
  9866. NewHandle, NewPtr, SetHandleSize, SetPtrSize, ReallocHandle, and
  9867. ResrvMem.
  9868.  
  9869. The grow zone function should be of the form
  9870.  
  9871.     FUNCTION MyGrowZone (cbNeeded: Size) : Size;
  9872.  
  9873.     The cbNeeded parameter gives the physical size of the needed block
  9874. in bytes, including the block header. The grow zone function should
  9875. attempt to create a free block of at least this size. It should return
  9876. a nonzero number if it's abale to allocate some memory, or 0 if it's not
  9877. able to allocate any.
  9878.  
  9879.     If the grow zone function returns 0, the Memory Manager will give up
  9880. trying to allocate the needed block and will signal failure with the
  9881. result code memFullErr. Otherwise it will compact the heap zone and
  9882. try again to allocate the block. If still unsuccessful, it will
  9883. continue to call the grow zone function repeatedly, compacting the zone
  9884. again after each call, until it either succeeds in allocating the
  9885. needed block or receives a zero result and gives up.
  9886.  
  9887.     The usual way for the grow zone function to free more space is to
  9888. call EmptyHandle to purge blocks that were previously marked
  9889. unpurgeable. Another possibility is to unlock blocks that were
  9890. previously locked.
  9891.  
  9892. (note)
  9893.     Although just unlocking blocks doesn't actually free any
  9894.     additional space in the zone, the grow zone function
  9895.     should still return a nonzero result in this case. This
  9896.     signals the Memory Manager to compact the heap and try
  9897.     again to allocate the needed block.
  9898.  
  9899. (warning)
  9900.     Depending on the circumstances in which the grow zone
  9901.     function is called, there may be particular blocks within
  9902.     the heap zone that must not be purged or released. For
  9903.     instance, if your program is attempting to increase the
  9904.     size of a relocatable block with SetHandleSize, it would
  9905.     be disastrous to release the block being expanded. To
  9906.     deal with such cases safely, it's essential to understand
  9907.     the use of the functions GZCritical and GZSaveHnd (see
  9908.     below).
  9909.  
  9910. (warning)
  9911.     Whenever you call the Resource Manager with
  9912.     SetResPurge(TRUE), it installs its own grow zone function
  9913.     into the application heap zone. The Resource Manager's
  9914.     grow zone function automatically writes to the disk all
  9915.     changed resources before they're purged. If you install
  9916.     your own grow zone function into the application heap
  9917.     zone, you shouldn't call SetResPurge(TRUE).
  9918.  
  9919.     Result codes
  9920.  
  9921.             noErr   No error
  9922. \ GZCritical
  9923. 14
  9924. FUNCTION GZCritical : BOOLEAN;    [No trap macro]
  9925.  
  9926.     GZCritical retruns TRUE if the Memory Manager critically needs
  9927. space-- for example, to create a new relocatable or nonrelocatable block
  9928. or to reallocate a handle. It returns FALSE in less critical cases,
  9929. such as ResrvMem trying to reserve space as low as possible in the heap
  9930. zone or SetHandleSize trying to increase the size of a relocatable
  9931. block. GZCritical doesn't affect the value returned by MemError.
  9932.  
  9933. (warning)
  9934.     If you're writing a grow zone function in Pascal, you
  9935.     should always call GZCritical and proceed only if the
  9936.     result is TRUE. All the information you need to handle
  9937.     the critical cases safely is the value of GZSaveHnd (see
  9938.     below). The noncritical cases require additional
  9939.     information that isn't available from Pascal, so your
  9940.     grow zone function should just return 0 and not attempt
  9941.     to free any space.
  9942. \ GZSaveHnd
  9943. 14
  9944. FUNCTION GZSaveHnd : Handle;   [No trap macro]
  9945.  
  9946.     GZSave Hnd retruns a handle to a relocatable block that mustn't be
  9947. purged or released by the grow zone function, or NIL if there is no
  9948. such block. For example, during a SetHandleSize call, the handle being
  9949. changed mustn't be purged. The grow zone function will be safe if it
  9950. avoids purging or releasing this block, provided that the grow zone
  9951. call was critical. To handle noncritical cases safely, further
  9952. information is needed that isn't available from Pascal. GZSaveHnd
  9953. doesn't affect the value returned by MemError.
  9954. \ BlockMove
  9955. 14
  9956. PROCEDURE BlockMove (sourcePtr,destPtr: Ptr; byteCount: Size);
  9957.  
  9958.  
  9959.     ___________________________________________________________
  9960.  
  9961.     Trap macro  _BlockMove
  9962.  
  9963.     On entry    A0:  sourcePtr (pointer)
  9964.                 A1:  destPtr (pointer)
  9965.                 D0:  byteCount (long integer)
  9966.  
  9967.     On exit     D0:  result code (integer)
  9968.     ___________________________________________________________
  9969.  
  9970.     BlockMove moves a block of byteCount consecutive bytes from the
  9971. address designated by sourcePtr to that designated by destPtr. No
  9972. pointers are updated.
  9973.  
  9974.     Result codes
  9975.  
  9976.             noErr   No error
  9977. \ TopMem
  9978. 14
  9979. FUNCTION TopMem : Ptr;   [No trap macro]
  9980.  
  9981.     TopMem returns a pointer to the address following the last byte of
  9982. RAM.
  9983.  
  9984.             _________________________________________________
  9985.  
  9986.     Assembly-language note:  To get a pointer to the end of RAM from
  9987.     assembly language, use the global variable MemTop.
  9988.             _________________________________________________
  9989.  
  9990.     Result codes
  9991.  
  9992.             noErr   No error
  9993. \ MemError
  9994. 14
  9995. FUNCTION MemError : OSErr;   [No trap macro]
  9996.  
  9997.     MemError returns the result code produced by the last Memory Manager
  9998. routine called. (OSErr is an Operating System Utility data type
  9999. declared as INTEGER.)
  10000. \MaxBlock
  10001. 14
  10002. FUNCTION MaxBlock : LONGINT;
  10003.     ______________________________________________________________
  10004.  
  10005.     Trap macro  _MaxBlock
  10006.                 _MaxBlock ,SYS  (applies to system heap)
  10007.  
  10008.     On exit     D0:  function result (word)
  10009.     ______________________________________________________________
  10010.     MaxBlock returns the maximum contiguous space in bytes that could be
  10011. obtained by compacting the current zone (without actually doing
  10012. the compaction).
  10013. \PurgeSpace
  10014. 14
  10015. PROCEDURE PurgeSpace (VAR total,contig: LONGINT);
  10016.     ______________________________________________________________
  10017.  
  10018.     Trap macro  _PurgeSpace
  10019.                 _PurgeSpace ,SYS    (applies to system heap)
  10020.  
  10021.     On exit     A0:  contig (long word)
  10022.                 D0:  total (long word)
  10023.     ______________________________________________________________
  10024.     PurgeSpace returns in total the total amount of space in bytes that
  10025. could be obtained by a general purge (without actually doing
  10026. the purge); this amount includes space that is already free.
  10027. The maximum contiguous space in bytes (including already free space)
  10028. that could be obtained by a purge is returned in contig.
  10029. \StackSpace
  10030. 14
  10031. FUNCTION StackSpace : LONGINT;
  10032.     ______________________________________________________________
  10033.  
  10034.     Trap macro  _StackSpace
  10035.  
  10036.     On exit     D0:  function result (word)
  10037.     ______________________________________________________________
  10038.     StackSpace returns the current amount of stack space between the
  10039. current stack pointer and the application heap (at the instant
  10040. of return from the trap).
  10041. \NewEmptyHandle
  10042. 14
  10043. FUNCTION NewEmptyHandle : Handle;
  10044.     ______________________________________________________________
  10045.  
  10046.     Trap macro  _NewEmptyHandle
  10047.                 _NewEmptyHandle ,SYS    (applies to system heap)
  10048.  
  10049.     On exit     A0:  function result (handle)
  10050.                 D0:  result code (word)
  10051.     ______________________________________________________________
  10052.  
  10053.     NewEmptyHandle is similar in function to NewHandle except that it
  10054. does not allocate any space; the handle returned is empty (in
  10055. other words, it points to a NIL master pointer). NewEmptyHandle
  10056. is used extensively by the Resource Manager; you may not need to use it.
  10057. \HSetRBit
  10058. 14
  10059. PROCEDURE HSetRBit (h: Handle);
  10060.     ______________________________________________________________
  10061.  
  10062.     Trap macro  _HSetRBit
  10063.  
  10064.     On entry    A0:  h (handle)
  10065.  
  10066.     On exit     D0:  result code (word)
  10067.     ______________________________________________________________
  10068.  
  10069.     HSetRBit sets the resource flag of a relocatable block’s master
  10070. pointer.
  10071. \HClrRBit
  10072. 14
  10073. PROCEDURE HClrRBit (h: Handle);
  10074.     ______________________________________________________________
  10075.  
  10076.     Trap macro  _HClrRBit
  10077.  
  10078.     On entry    A0:  h (handle)
  10079.  
  10080.     On exit     D0:  result code (word)
  10081.     ______________________________________________________________
  10082.     HClrRBit clears the resource flag of a relocatable block’s master
  10083. pointer.
  10084. \HGetState
  10085. 14
  10086. FUNCTION HGetState (h: Handle) : SignedByte;
  10087.     ______________________________________________________________
  10088.  
  10089.     Trap macro  _HGetState
  10090.  
  10091.     On entry    A0:  h (handle)
  10092.  
  10093.     On exit     D0:  flags (byte)
  10094.     ______________________________________________________________
  10095.     HGetState returns the byte that contains the flags of the master
  10096. pointer for the given handle; it’s used in conjunction with HSetState
  10097. to save and restore the state of the flags contained in this byte.
  10098. You can save this byte, change the state of any of the flags (using
  10099. the routines described above), and then restore their original state
  10100. by passing the byte back to the HSetState procedure (described below).
  10101. \HSetState
  10102. 14
  10103. PROCEDURE HSetState (h: Handle; flags: SignedByte);
  10104.     ______________________________________________________________
  10105.  
  10106.     Trap macro  _HSetState
  10107.  
  10108.     On entry    A0:  h (handle)
  10109.                 D0:  flags (byte)
  10110.  
  10111.     On exit     D0:  result code (word)
  10112.     ______________________________________________________________
  10113.  
  10114.     HSetState is used in conjunction with HGetState; it sets the byte
  10115. that contains the flags of the master pointer for the given handle
  10116. to the byte specified by flags.
  10117. \ UnloadSeg
  10118. 15
  10119. PROCEDURE UnloadSeg (routineAddr: Ptr);
  10120.  
  10121.     UnloadSeg unloads a segment, making it relocatable and purgeable;
  10122. routineAddr is the address of any externally referenced routine in the
  10123. segment. The segment won't actually be purged until the memory it
  10124. occupies is needed. If the segment is purged, the Segment Loader will
  10125. reload it the next time one of the routines in it is called.
  10126. \ CountAppFiles
  10127. 15
  10128. PROCEDURE COuntAppFiles (VAR message:  INTEGER; VAR count: INTEGER);
  10129.  
  10130.     CountAppFiles deciphers the Finder information passed to your
  10131. application, and returns information about the documents that were
  10132. selected when your application was started up. It returns the number
  10133. of selected documents in the count parameter, and a number in the
  10134. message parameter that indicates whether the documents are to be opened
  10135. or printed:
  10136.  
  10137.     CONST appOpen  = 0;   {open the document(s)}
  10138.           appPrint = 1;   {print the document(s)}
  10139. \ GetAppFiles
  10140. 15
  10141. PROCEDURE GetAppFiles (index: INTEGER; VAR theFile: AppFile);
  10142.  
  10143.     GetAppFiles returns information about a document that was selected
  10144. when your application was started up (as listed in the Finder
  10145. information). The index parameter indicates the file for which
  10146. information should be returned; it must be between 1 and the number
  10147. returned by CountAppFiles, inclusive. The information is returned in
  10148. the following data structure:
  10149.  
  10150.     TYPE AppFile = RECORD
  10151.             vRefNum: INTEGER;  {volume reference number}
  10152.             fType:   OSType;   {file type}
  10153.             versNum: INTEGER;  {version number}
  10154.             fName:   Str255;   {file name}
  10155.           END;
  10156.  
  10157.     Volume reference number, file type, version number, and file name
  10158. are discussed in the File Manager manual.
  10159. \ ClrAppFiles
  10160. 15
  10161. PROCEDURE ClrAppFiles (index: INTEGER);
  10162.  
  10163.     ClrAppFiles changes the Finder information passed to your aplication
  10164. about the specified file such that the Finder knows you've processed
  10165. the file. The index parameter must be between 1 and the number
  10166. returned by CountAppFiles, inclusive. You should call ClrAppFiles for
  10167. every document your application opens or prints, so that the
  10168. information returned by CountAppFiles and GetAppFiles is always
  10169. correct. (ClrAppFiles sets the file type in the Finder information to
  10170. 0.)
  10171. \ GetAppParms
  10172. 15
  10173. PROCEDURE GetAppParms (VAR apName: STRING[31]; VAR apRefNum: INTEGER;
  10174.         VAR apParam: Handle);
  10175.  
  10176.     GetAppParms returns information about the current application. It
  10177. returns the application name in apName and the reference number for the
  10178. application's resource file in apRefNum. A handle to the Finder
  10179. information is returned in apParam, but the Finder information is more
  10180. easily accessed with the GetAppFiles call.
  10181. \ ExitToShell
  10182. 15
  10183. PROCEDURE ExitToShell;
  10184.  
  10185.     ExitToShell provides an exit from an application by starting up the
  10186. Finder (after releasing the entire application heap).
  10187. \ GetOSEvent
  10188. 16
  10189. FUNCTION GetOSEvent (eventMask: INTEGER; VAR theEvent: EventRecord) :
  10190.                         BOOLEAN;
  10191.  
  10192.     ____________________________________________________________
  10193.  
  10194.     Trap macro  _GetOSEvent
  10195.  
  10196.     On entry    A0:  pointer to event record theEvent
  10197.                 D0:  eventMask (word)
  10198.  
  10199.     On exit     D0:  0 if non-null event returned, or
  10200.                  -1 if null event returned (byte)
  10201.     ____________________________________________________________
  10202.  
  10203.     GEtOSEvent returns the next available event of a specified type or
  10204. types and removes it from the event queue. The event is returned as
  10205. the value of the parameter theEvent. The eventMask parameter specifies
  10206. which event types are of interest. GetOSEvent will return the next
  10207. available event of any type designated by the mask. If no event of any
  10208. of the designated types is available, GetOSEvent returns a null event
  10209. and a function result of FALSE; otherwise it returns TRUE.
  10210. \ OSEventAvail
  10211. 16
  10212. FUNCTION OSEventAvail (eventMask: INTEGER; VAR theEvent: EventRecord) :
  10213.                         BOOLEAN;
  10214.  
  10215.     __________________________________________________________________
  10216.  
  10217.     Trap macro  _OSEventAvail
  10218.  
  10219.     On entry    A0:  pointer to event record theEvent
  10220.                 D0:  eventMask (word)
  10221.  
  10222.     On exit     D0:  0 if not-null event returned, or
  10223.                     -1 if null event returned (byte)
  10224.     __________________________________________________________________
  10225.  
  10226.     OSEventAvail works exactly the same as GetOSEvent (above) except
  10227. that it doesn't remove the event from the event queue.
  10228.  
  10229. (note)
  10230.     An event returned by OSEventAvail will not be accessible
  10231.     later if in the meantime the queue becomes full and the
  10232.     event is discarded from it; since the events discarded
  10233.     are always the oldest ones in the queue, however, this
  10234.     will happen only in an unusually busy environment.
  10235. \ SetEventMask
  10236. 16
  10237. PROCEDURE SetEventMask (theMask: INTEGER);  [No trap macro]
  10238.  
  10239.     SetEventMask sets the system event mask to the specified event mask.
  10240. The Operating System Event Manager will post only those event types
  10241. that correspond to bits set in the mask. (As usual, it will not post
  10242. activate and update events, which are generated by the Window Manager
  10243. and not stored in the event queue.)  The system event mask is initially
  10244. set to post all except key-up events.
  10245.  
  10246. (warning)
  10247.     Because desk accessories may rely on receiving certain
  10248.     types of events, your application shouldn't set the
  10249.     system event mask to prevent any additional types
  10250.     (besides key-up) from being posted. You should use
  10251.     SetEventMask only to enable key-up events in the unusual
  10252.     case that your application needs to respond to them.
  10253. \ GetEvQHdr
  10254. 16
  10255. FUNCTION GetEvQHdr : QHdrPtr;  [No trap macro]
  10256.  
  10257.     GetEvQHdr retruns a pointer to the event queue.
  10258. \ PPostEvent
  10259. 16
  10260. FUNCTION PPostEvent (eventCode: INTEGER; eventMsg: LONGINT;
  10261.                         VAR qEl: EvQEl) : OSErr);
  10262.     ____________________________________________________________
  10263.  
  10264.         Trap macro  _PPostEvent
  10265.  
  10266.         On entry    A0:  eventCode (word)
  10267.                     D0:  eventMsg (long word)
  10268.  
  10269.         On exit     A0:  pointer to event queue entry
  10270.     ____________________________________________________________
  10271.     PPostEvent is identical to PostEvent except that it returns a
  10272. pointer to the created queue entry.
  10273. \ GetVInfo
  10274. 17
  10275. FUNCTION GetVInfo (drvNum: INTEGER; volName: StringPtr;
  10276.                   VAR vRefNum: INTEGER; VAR freeBytes: LONGINT)
  10277.                   : OSErr;  [Not in ROM]
  10278.  
  10279.     GetVInfo returns the name, reference number, and available space
  10280. (in bytes), in volName, vRefNum, and freeBytes, for the volume in
  10281. the drive specified by drvNum.
  10282.  
  10283. Result codes    noErr     No error
  10284.                 nsvErr    No default volume
  10285.                 paramErr  Bad drive number
  10286. \ GetVRefNum
  10287. 17
  10288. FUNCTION GetVRefNum (pathRefNum: INTEGER; VAR vRefNum: INTEGER)
  10289.                     : OSErr;  [Not in ROM]
  10290.  
  10291.     Given a path reference number in pathRefNum, GetVRefNum returns
  10292. the volume reference number in vRefNum.
  10293.  
  10294. Result codes    noErr       No error
  10295.                 rfNumErr    Bad reference number
  10296. \ GetVol
  10297. 17
  10298. FUNCTION GetVol (volName: StringPtr; VAR vRefNum: INTEGER)
  10299.                 : OSErr;  [Not in ROM]
  10300.  
  10301.     GetVol returns the name of the default volume in volName and its
  10302. volume reference number in vRefNum.
  10303.  
  10304. Result codes    noErr   No error
  10305.                 nsvErr  No such volume
  10306. \ SetVol
  10307. 17
  10308. FUNCTION SetVol (volName: StringPtr; vRefNum: INTEGER)
  10309.                 : OSErr;  [Not in ROM]
  10310.  
  10311.     SetVol sets the default volume to the mounted volume specified
  10312. by volName or vRefNum.
  10313.  
  10314. Result codes    noErr       No error
  10315.                 bdNamErr    Bad volume name
  10316.                 nsvErr      No such volume
  10317.                 paramErr    No default volume
  10318. \ FlushVol
  10319. 17
  10320. FUNCTION FlushVol (volName: StringPtr; vRefNum: INTEGER)
  10321.                     : OSErr;  [Not in ROM]
  10322.  
  10323.     On the volume specified by volName or vRefNum, FlushVol writes
  10324. the contents of the associated volume buffer and descriptive
  10325. information about the volume (if they’ve changed since the last
  10326. time FlushVol was called).
  10327.  
  10328. Result codes    noErr       No error
  10329.                 bdNamErr    Bad volume name
  10330.                 extFSErr    External file system
  10331.                 ioErr       I/O error
  10332.                 nsDrvErr    No such drive
  10333.                 nsvErr      No such volume
  10334.                 paramErr    No default volume
  10335. \ UnmountVol
  10336. 17
  10337. FUNCTION UnmountVol (volName: StringPtr; vRefNum: INTEGER)
  10338.                     : OSErr;  [Not in ROM]
  10339.  
  10340.     UnmountVol unmounts the volume specified by volName or vRefNum,
  10341. by calling FlushVol to flush the volume buffer, closing all
  10342. open files on the volume, and releasing the memory used for the volume.
  10343.  
  10344. Warning:  Don’t unmount the startup volume.
  10345.  
  10346. Result codes    noErr       No error
  10347.                 bdNamErr    Bad volume name
  10348.                 extFSErr    External file system
  10349.                 ioErr       I/O error
  10350.                 nsDrvErr    No such drive
  10351.                 nsvErr      No such volume
  10352.                 paramErr    No default volume
  10353. \ Eject
  10354. 17
  10355. FUNCTION Eject (volName: StringPtr; vRefNum: INTEGER)
  10356.                 : OSErr;  [Not in ROM]
  10357.  
  10358.     Eject flushes the volume specified by volName or vRefNum,
  10359. places it off-line, and then ejects the volume.
  10360.  
  10361. Result codes    noErr       No error
  10362.                 bdNamErr    Bad volume name
  10363.                 extFSErr    External file system
  10364.                 ioErr       I/O error
  10365.                 nsDrvErr    No such drive
  10366.                 nsvErr      No such volume
  10367.                 paramErr    No default volume
  10368. \ Create
  10369. 17
  10370. FUNCTION Create (fileName: Str255; vRefNum: INTEGER; creator: OSType;
  10371.                 fileType: OSType) : OSErr;  [Not in ROM]
  10372.  
  10373.     Create creates a new file (both forks) with the specified name,
  10374. file type, and creator on the specified volume. (File type and
  10375. creator are discussed in the Finder Interface chapter.)
  10376. The new file is unlocked and empty. The date and time of its
  10377. creation and last modification are set to the current date and time.
  10378.  
  10379. Result codes    noErr       No error
  10380.                 bdNamErr    Bad file name
  10381.                 dupFNErr    Duplicate file name and version
  10382.                 dirFulErr   File directory full
  10383.                 extFSErr    External file system
  10384.                 ioErr       I/O error
  10385.                 nsvErr      No such volume
  10386.                 vLckdErr    Software volume lock
  10387.                 wPrErr      Hardware volume lock
  10388. \ FSOpen
  10389. 17
  10390. FUNCTION FSOpen (fileName: Str255; vRefNum: INTEGER; VAR refNum: INTEGER)
  10391.                 : OSErr;  [Not in ROM]
  10392.  
  10393.     FSOpen creates an access path to the file having the name fileName
  10394. on the volume specified by vRefNum. A path reference number is returned
  10395. in refNum. The access path’s read/write permission is set to whatever
  10396. the file’s open permission allows.
  10397.  
  10398. Note:  There’s no guarantee that any bytes have been written until
  10399.        FlushVol is called.
  10400.  
  10401. Result codes    noErr       No error
  10402.                 bdNamErr    Bad file name
  10403.                 extFSErr    External file system
  10404.                 fnfErr      File not found
  10405.                 ioErr       I/O error
  10406.                 nsvErr      No such volume
  10407.                 opWrErr     File already open for writing
  10408.                 tmfoErr     Too many files open
  10409. \ FSRead
  10410. 17
  10411. FUNCTION FSRead (refNum: INTEGER; VAR count: LONGINT; buffPtr: Ptr)
  10412.                 : OSErr;  [Not in ROM]
  10413.  
  10414.     FSRead attempts to read the number of bytes specified by the count
  10415. parameter from the open file whose access path is specified by
  10416. refNum, and transfer them to the data buffer pointed to by buffPtr.
  10417. The read operation begins at the current mark, so you might want to
  10418. precede this with a call to SetFPos. If you try to read past the
  10419. logical end-of-file, FSRead moves the mark to the end-of-file and
  10420. returns eofErr as its function result. After the read is completed,
  10421. the number of bytes actually read is returned in the count parameter.
  10422.  
  10423. Result codes    noErr       No error
  10424.                 eofErr      End-of-file
  10425.                 extFSErr    External file system
  10426.                 fnOpnErr    File not open
  10427.                 ioErr       I/O error
  10428.                 paramErr    Negative count
  10429.                 rfNumErr    Bad reference number
  10430. \ FSWrite
  10431. 17
  10432. FUNCTION FSWrite (refNum: INTEGER; VAR count: LONGINT; buffPtr: Ptr)
  10433.                     : OSErr;  [Not in ROM]
  10434.  
  10435.     FSWrite takes the number of bytes specified by the count parameter
  10436. from the buffer pointed to by buffPtr and attempts to write them to
  10437. the open file whose access path is specified by refNum. The write
  10438. operation begins at the current mark, so you might want to precede
  10439. this with a call to SetFPos. After the write is completed, the number
  10440. of bytes actually written is returned in the count parameter.
  10441.  
  10442. Result codes    noErr       No error
  10443.                 dskFulErr   Disk full
  10444.                 fLckdErr    File locked
  10445.                 fnOpnErr    File not open
  10446.                 ioErr       I/O error
  10447.                 paramErr    Negative count
  10448.                 rfNumErr    Bad reference number
  10449.                 vLckdErr    Software volume lock
  10450.                 wPrErr      Hardware volume lock
  10451.                 wrPermErr   Read/write permission doesn’t allow writing
  10452. \ GetFPos
  10453. 17
  10454. FUNCTION GetFPos (refNum: INTEGER; VAR filePos: LONGINT)
  10455.                 : OSErr;  [Not in ROM]
  10456.  
  10457.     GetFPos returns, in filePos, the mark of the open file whose access
  10458. path is specified by refNum.
  10459.  
  10460. Result codes    noErr       No error
  10461.                 extFSErr    External file system
  10462.                 fnOpnErr    File not open
  10463.                 ioErr       I/O error
  10464.                 rfNumErr    Bad reference number
  10465. \ SetFPos
  10466. 17
  10467. FUNCTION SetFPos (refNum: INTEGER; posMode: INTEGER; posOff: LONGINT)
  10468.                     : OSErr;  [Not in ROM]
  10469.  
  10470.     SetFPos sets the mark of the open file whose access path is
  10471. specified by refNum to the position specified by posMode and posOff
  10472. (except when posMode is equal to fsAtMark, in which case posOff is
  10473. ignored). PosMode indicates how to position the mark; it must contain
  10474. one of the following values:
  10475.  
  10476. CONST fsAtMark    = 0;  {at current mark}
  10477.       fsFromStart = 1;  {set mark relative to beginning of file}
  10478.       fsFromLEOF  = 2;  {set mark relative to logical end-of-file}
  10479.       fsFromMark  = 3;  {set mark relative to current mark}
  10480.  
  10481.     If you specify fsAtMark, posOffset is ignored and the mark is left
  10482. wherever it’s currently positioned. If you choose to set the mark
  10483. (relative to either the beginning of the file, the logical end-of-file,
  10484. or the current mark), posOffset specifies the byte offset from the
  10485. chosen point (either positive or negative) where the mark should be set.
  10486. If you try to set the mark past the logical end-of-file, SetFPos moves
  10487. the mark to the end-of-file and returns eofErr as its function result.
  10488.  
  10489. Result codes    noErr       No error
  10490.                 eofErr      End-of-file
  10491.                 extFSErr    External file system
  10492.                 fnOpnErr    File not open
  10493.                 ioErr       I/O error
  10494.                 posErr      Attempt to position before start of file
  10495.                 rfNumErr    Bad reference number
  10496.  
  10497. \ GEtEOF
  10498. 17
  10499. FUNCTION GetEOF (refNum: INTEGER; VAR logEOF: LONGINT)
  10500.                 : OSErr;  [Not in ROM]
  10501.  
  10502.     GetEOF returns, in logEOF, the logical end-of-file of the open
  10503. file whose access path is specified by refNum.
  10504.  
  10505. Result codes    noErr       No error
  10506.                 extFSErr    External file system
  10507.                 fnOpnErr    File not open
  10508.                 ioErr       I/O error
  10509.                 rfNumErr    Bad reference number
  10510. \ SetEOF
  10511. 17
  10512. FUNCTION SetEOF (refNum: INTEGER; logEOF: LONGINT)
  10513.                 : OSErr;  [Not in ROM]
  10514.  
  10515.     SetEOF sets the logical end-of-file of the open file whose access
  10516. path is specified by refNum to the position specified by logEOF.
  10517. If you attempt to set the logical end-of-file beyond the physical
  10518. end-of-file, the physical end-of-file is set to one byte beyond
  10519. the end of the next free allocation block; if there isn’t enough
  10520. space on the volume, no change is made, and SetEOF returns dskFulErr
  10521. as its function result. If logEOF is 0, all space occupied by the file
  10522. on the volume is released.
  10523.  
  10524. Result codes    noErr       No error
  10525.                 dskFulErr   Disk full
  10526.                 extFSErr    External file system
  10527.                 fLckdErr    File locked
  10528.                 fnOpnErr    File not open
  10529.                 ioErr       I/O error
  10530.                 rfNumErr    Bad reference number
  10531.                 vLckdErr    Software volume lock
  10532.                 wPrErr      Hardware volume lock
  10533.                 wrPermErr   Read/write permission doesn’t allow writing
  10534. \ Allocate
  10535. 17
  10536. FUNCTION Allocate (refNum: INTEGER; VAR count: LONGINT)
  10537.                     : OSErr;  [Not in ROM]
  10538.  
  10539.     Allocate adds the number of bytes specified by the count parameter
  10540. to the open file whose access path is specified by refNum, and sets the
  10541. physical end-of-file to one byte beyond the last block allocated.
  10542. The number of bytes actually allocated is rounded up to the nearest
  10543. multiple of the allocation block size, and returned in the count
  10544. parameter. If there isn’t enough empty space on the volume to satisfy
  10545. the allocation request, Allocate allocates the rest of the space on the
  10546. volume and returns dskFulErr as its function result.
  10547.  
  10548. Result codes    noErr       No error
  10549.                 dskFulErr   Disk full
  10550.                 fLckdErr    File locked
  10551.                 fnOpnErr    File not open
  10552.                 ioErr       I/O error
  10553.                 rfNumErr    Bad reference number
  10554.                 vLckdErr    Software volume lock
  10555.                 wPrErr      Hardware volume lock
  10556.                 wrPermErr   Read/write permission doesn’t allow writing
  10557. \ FSClose
  10558. 17
  10559. FUNCTION FSClose (refNum: INTEGER) : OSErr;  [Not in ROM]
  10560.  
  10561.     FSClose removes the access path specified by refNum, writes the
  10562. contents of the volume buffer to the volume, and updates the file’s
  10563. entry in the file directory.
  10564.  
  10565. Note:  There’s no guarantee that any bytes have been written until
  10566.        FlushVol is called.
  10567.  
  10568. Result codes    noErr       No error
  10569.                 extFSErr    External file system
  10570.                 fnfErr      File not found
  10571.                 fnOpnErr    File not open
  10572.                 ioErr       I/O error
  10573.                 nsvErr      No such volume
  10574.                 rfNumErr    Bad reference number
  10575. \ GetFInfo
  10576. 17
  10577. FUNCTION GetFInfo (fileName: Str255; vRefNum: INTEGER; VAR
  10578.                     fndrInfo: FInfo) : OSErr;  [Not in ROM]
  10579.  
  10580.     For the file having the name fileName on the specified volume,
  10581. GetFInfo returns information used by the Finder in fndrInfo
  10582. (see the section “File Information Used by the Finder”).
  10583.  
  10584. Result codes    noErr       No error
  10585.                 bdNamErr    Bad file name
  10586.                 extFSErr    External file system
  10587.                 fnfErr      File not found
  10588.                 ioErr       I/O error
  10589.                 nsvErr      No such volume
  10590.                 paramErr    No default volume
  10591. \ SetFInfo
  10592. 17
  10593. FUNCTION SetFInfo (fileName: Str255; vRefNum: INTEGER;
  10594.                     fndrInfo: FInfo) : OSErr;  [Not in ROM]
  10595.  
  10596.     For the file having the name fileName on the specified volume,
  10597. SetFInfo sets information used by the Finder to fndrInfo (see
  10598. the section “File Information Used by the Finder”).
  10599.  
  10600. Result codes    noErr       No error
  10601.                 extFSErr    External file system
  10602.                 fLckdErr    File locked
  10603.                 fnfErr      File not found
  10604.                 ioErr       I/O error
  10605.                 nsvErr      No such volume
  10606.                 vLckdErr    Software volume lock
  10607.                 wPrErr      Hardware volume lock
  10608. \ SetFLock
  10609. 17
  10610. FUNCTION SetFLock (fileName: Str255; vRefNum: INTEGER)
  10611.                 : OSErr;  [Not in ROM]
  10612.  
  10613.     SetFLock locks the file having the name fileName on the specified
  10614. volume. Access paths currently in use aren’t affected.
  10615.  
  10616. Result codes    noErr       No error
  10617.                 extFSErr    External file system
  10618.                 fnfErr      File not found
  10619.                 ioErr       I/O error
  10620.                 nsvErr      No such volume
  10621.                 vLckdErr    Software volume lock
  10622.                 wPrErr      Hardware volume lock
  10623. \ RstFLock
  10624. 17
  10625. FUNCTION RstFLock (fileName: Str255; vRefNum: INTEGER)
  10626.                     : OSErr;  [Not in ROM]
  10627.  
  10628.     RstFLock unlocks the file having the name fileName on the specified
  10629. volume. Access paths currently in use aren’t affected.
  10630.  
  10631. Result codes    noErr       No error
  10632.                 extFSErr    External file system
  10633.                 fnfErr      File not found
  10634.                 ioErr       I/O error
  10635.                 nsvErr      No such volume
  10636.                 vLckdErr    Software volume lock
  10637.                 wPrErr      Hardware volume lock
  10638. \ Rename
  10639. 17
  10640. FUNCTION Rename (oldName: Str255; vRefNum: INTEGER; newName: Str255)
  10641.                 : OSErr;  [Not in ROM]
  10642.  
  10643.     Given a file name in oldName, Rename changes the name of the file to
  10644. newName. Access paths currently in use aren’t affected. Given a volume
  10645. name in oldName or a volume reference number in vRefNum, Rename changes
  10646. the name of the specified volume to newName.
  10647.  
  10648. Warning:  If you’re renaming a volume, be sure that both names end with
  10649.           a colon.
  10650.  
  10651. Result codes    noErr       No error
  10652.                 bdNamErr    Bad file name
  10653.                 dirFulErr   Directory full
  10654.                 dupFNErr    Duplicate file name
  10655.                 extFSErr    External file system
  10656.                 fLckdErr    File locked
  10657.                 fnfErr      File not found
  10658.                 fsRnErr     Problem during rename
  10659.                 ioErr       I/O error
  10660.                 nsvErr      No such volume
  10661.                 paramErr    No default volume
  10662.                 vLckdErr    Software volume lock
  10663.                 wPrErr      Hardware volume lock
  10664. \ FSDelete
  10665. 17
  10666. FUNCTION FSDelete (fileName: Str255; vRefNum: INTEGER)
  10667.                     : OSErr;  [Not in ROM]
  10668.  
  10669.     FSDelete removes the closed file having the name fileName from the
  10670. specified volume.
  10671.  
  10672. Note:  This function will delete both forks of a file.
  10673.  
  10674. Result codes    noErr       No error
  10675.                 bdNamErr    Bad file name
  10676.                 extFSErr    External file system
  10677.                 fBsyErr     File busy
  10678.                 fLckdErr    File locked
  10679.                 fnfErr      File not found
  10680.                 ioErr       I/O error
  10681.                 nsvErr      No such volume
  10682.                 vLckdErr    Software volume lock
  10683.                 wPrErr      Hardware volume lock
  10684. \ OpenRF
  10685. 17
  10686. FUNCTION OpenRF (fileName: Str255; vRefNum: INTEGER;
  10687.                 VAR refNum: INTEGER) : OSErr;  [Not in ROM]
  10688.  
  10689.     OpenRF is similar to FSOpen; the only difference is that OpenRF
  10690. opens the resource fork of the specified file rather than the data fork.
  10691. A path reference number is returned in refNum. The access path’s
  10692. read/write permission is set to whatever the file’s open permission
  10693. allows.
  10694.  
  10695. Note:  Normally you should access a file’s resource fork through the
  10696.        routines of the Resource Manager rather than the File Manager.
  10697.        OpenRF doesn’t read the resource map into memory; it’s really
  10698.        only useful for block-level operations such as copying files.
  10699.  
  10700. Result codes    noErr       No error
  10701.                 bdNamErr    Bad file name
  10702.                 extFSErr    External file system
  10703.                 fnfErr      File not found
  10704.                 ioErr       I/O error
  10705.                 nsvErr      No such volume
  10706.                 opWrErr     File already open for writing
  10707.                 tmfoErr     Too many files open
  10708. \ FInitQueue
  10709. 17
  10710. PROCEDURE InitQueue;
  10711.  
  10712. Trap macro  _InitQueue
  10713.  
  10714. FInitQueue clears all queued File Manager calls except the current one.
  10715. \ PBMountVol
  10716. 17
  10717. FUNCTION PBMountVol (paramBlock: ParmBlkPtr) : OSErr;
  10718.  
  10719. Trap macro  _MountVol
  10720.  
  10721. Parameter block
  10722.     <—  16  ioResult    word
  10723.     <–> 22  ioVRefNum   word
  10724.  
  10725.     PBMountVol mounts the volume in the drive specified by ioVRefNum,
  10726. and returns a volume reference number in ioVRefNum. If there are no
  10727. volumes already mounted, this volume becomes the default volume.
  10728. PBMountVol is always executed synchronously.
  10729.  
  10730. Note:  When mounting hierarchical volumes, PBMountVol opens two files
  10731.        needed for maintaining file directory and file mapping
  10732.        information. PBMountVol can fail if there are no access paths
  10733.        available for these two files; it will return tmfoErr as its
  10734.        function result.
  10735.  
  10736. Result codes    noErr       No error
  10737.                 badMDBErr   Bad master directory block
  10738.                 extFSErr    External file system
  10739.                 ioErr       I/O error
  10740.                 memFullErr  Not enough room in heap zone
  10741.                 noMacDskErr Not a Macintosh disk
  10742.                 nsDrvErr    No such drive
  10743.                 paramErr    Bad drive number
  10744.                 tmfoErr     Too many files open
  10745.                 volOnLinErr Volume already on-line
  10746. \ PBGetVInfo
  10747. 17
  10748. FUNCTION PBGetVInfo (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  10749.  
  10750. Trap macro  _GetVolInfo
  10751.  
  10752. Parameter block
  10753.     —>  12      ioCompletion    pointer
  10754.     <—  16      ioResult        word
  10755.     <–> 18      ioNamePtr       pointer
  10756.     <–> 22      ioVRefNum       word
  10757.     —>  28      ioVolIndex      word
  10758.     <—  30      ioVCrDate       long word
  10759.     <—  34      ioVLsBkUp       long word
  10760.     <—  38      ioVAtrb         word
  10761.     <—  40      ioVNmFls        word
  10762.     <—  42      ioVDirSt        word
  10763.     <—  44      ioVBlLn         word
  10764.     <—  46      ioVNmAlBlks     word
  10765.     <—  48      ioVAlBlkSiz     long word
  10766.     <—  52      ioVClpSiz       long word
  10767.     <—  56      ioAlBlSt        word
  10768.     <—  58      ioVNxtFNum      long word
  10769.     <—  62      ioVFrBlk        word
  10770.  
  10771.     PBGetVInfo returns information about the specified volume. If
  10772. ioVolIndex is positive, the File Manager attempts to use it to find the
  10773. volume; for instance, if ioVolIndex is 2, the File Manager will attempt
  10774. to access the second mounted volume. If ioVolIndex is negative, the
  10775. File Manager uses ioNamePtr and ioVRefNum in the standard way (described
  10776. in the section “Specifying Volumes, Directories, and Files”) to
  10777. determine which volume. If ioVolIndex is 0, the File Manager attempts
  10778. to access the volume by using ioVRefNum only. The volume reference
  10779. number is returned in ioVRefNum, and a pointer to the volume name is
  10780. returned in ioNamePtr (unless ioNamePtr is NIL).
  10781.  
  10782.     If a working directory reference number is passed in ioVRefNum (or
  10783. if the default directory is a subdirectory), the number of files and
  10784. directories in the specified directory (the directory’s valence) will be
  10785. returned in ioVNmFls. Also, the volume reference number won’t be
  10786. returned; ioVRefNum will still contain the working directory reference
  10787. number.
  10788.  
  10789. Warning:  IOVNmAlBlks and ioVFrBlks, which are actually unsigned
  10790.           integers, are clipped to 31744 ($7C00) regardless of the size
  10791.           of the volume.
  10792.  
  10793. Result codes    noErr       No error
  10794.                 nsvErr      No such volume
  10795.                 paramErr    No default volume
  10796. \ PBHGetVInfo
  10797. 17
  10798. FUNCTION PBHGetVInfo (paramBlock: HParmBlkPtr; async: BOOLEAN) : OSErr;
  10799.  
  10800. Trap macro  _HGetVInfo
  10801.  
  10802. Parameter block
  10803.     —>  12  ioCompletion    pointer
  10804.     <—  16  ioResult        word
  10805.     <–> 18  ioNamePtr       pointer
  10806.     <–> 22  ioVRefNum       word
  10807.     —>  28  ioVolIndex      word
  10808.     <—  30  ioVCrDate       long word
  10809.     <—  34  ioVLsMod        long word
  10810.     <—  38  ioVAtrb         word
  10811.     <—  40  ioVNmFls        word
  10812.     <—  42  ioVBitMap       word
  10813.     <—  44  ioVAllocPtr     word
  10814.     <—  46  ioVNmAlBlks     word
  10815.     <—  48  ioVAlBlkSiz     long word
  10816.     <—  52  ioVClpSiz       long word
  10817.     <—  56  ioAlBlSt        word
  10818.     <—  58  ioVNxtFNum      long word
  10819.     <—  62  ioVFrBlk        word
  10820.     <—  64  ioVSigWord      word
  10821.     <—  66  ioVDrvInfo      word
  10822.     <—  68  ioVDRefNum      word
  10823.     <—  70  ioVFSID         word
  10824.     <—  72  ioVBkUp         long word
  10825.     <—  76  ioVSeqNum       word
  10826.     <—  78  ioVWrCnt        long word
  10827.     <—  82  ioVFilCnt       long word
  10828.     <—  86  ioVDirCnt       long word
  10829.     <—  90  ioVFndrInfo     32 bytes
  10830.  
  10831.     PBHGetVInfo is similar in function to PBGetVInfo but returns a
  10832. larger parameter block. In addition, PBHGetVInfo always returns the
  10833. volume reference number in ioVRefNum (regardless of what was passed in).
  10834. Also, ioVNmAlBlks and ioVFrBlks are not clipped as they are by
  10835. PBGetVInfo.
  10836.  
  10837. Result codes    noErr       No error
  10838.                 nsvErr      No such volume
  10839.                 paramErr    No default volume
  10840. \ PBSetVInfo
  10841. 17
  10842. FUNCTION PBSetVInfo (paramBlock: HParmBlkPtr; async: BOOLEAN) : OSErr;
  10843.  
  10844. Trap macro  _SetVolInfo
  10845.  
  10846. Parameter block
  10847.     —>  12  ioCompletion    pointer
  10848.     <—  16  ioResult        word
  10849.     —>  18  ioNamePtr       pointer
  10850.     —>  22  ioVRefNum       word
  10851.     —>  30  ioVCrDate       long word
  10852.     —>  34  ioVLsMod        long word
  10853.     —>  38  ioVAtrb         word
  10854.     —>  52  ioVClpSiz       long word
  10855.     —>  72  ioVBkUp         long word
  10856.     —>  76  ioVSeqNum       word
  10857.     —>  90  ioVFndrInfo     32 bytes
  10858.  
  10859.     PBSetVInfo lets you modify information about volumes. A pointer to
  10860. a new name for the volume can be specified in ioNamePtr. The date and
  10861. time of the volume’s creation and modification can be set with ioVCrDate
  10862. and ioVLsMod respectively. Only bit 15 of ioVAtrb can be changed;
  10863. setting it locks the volume.
  10864.  
  10865. Note: The volume cannot be specified by name; you must use either the
  10866.        volume reference number or the drive number.
  10867.  
  10868. Warning:  PBSetVInfo operates only with the hierarchical version of the
  10869.           File Manager; if used on a Macintosh equipped only with the
  10870.           64K ROM version of the File Manager, it will generate a system
  10871.           error.
  10872.  
  10873. Result codes    noErr       No error
  10874.                 nsvErr      No such volume
  10875.                 paramErr    No default volume
  10876. \ PBGetVol
  10877. 17
  10878. FUNCTION PBGetVol (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  10879.  
  10880. Trap macro  _GetVol
  10881.  
  10882. Parameter block
  10883.     —>  12  ioCompletion    pointer
  10884.     <—  16  ioResult        word
  10885.     <—  18  ioNamePtr       pointer
  10886.     <—  22  ioVRefNum       word
  10887.  
  10888.     PBGetVol returns a pointer to the name of the default volume in
  10889. ioNamePtr (unless ioNamePtr is NIL) and its volume reference number in
  10890. ioVRefNum. If a default directory was set with a previous PBSetVol
  10891. call, a pointer to its name will be returned in ioNamePtr and its
  10892. working directory reference number in ioVRefNum.
  10893.  
  10894. Result codes    noErr   No error
  10895.                 nsvErr  No default volume
  10896. \ PBHGetVol
  10897. 17
  10898. FUNCTION PBHGetVol (paramBlock: WDPBPtr; async: BOOLEAN) : OSErr;
  10899.  
  10900. Trap macro  _HGetVol
  10901.  
  10902. Parameter block
  10903.     —>  12  ioCompletion    pointer
  10904.     <—  16  ioResult        word
  10905.     <—  18  ioNamePtr       pointer
  10906.     <—  22  ioVRefNum       word
  10907.     <—  28  ioWDProcID      long word
  10908.     <—  32  ioWDVRefNum     word
  10909.     <—  48  ioWDDirID       long word
  10910.  
  10911.     PBHGetVol returns the default volume and directory last set by
  10912. either a PBSetVol or a PBHSetVol call. The reference number of the
  10913. default volume is returned in ioVRefNum.
  10914.  
  10915. Warning:  IOVRefNum will return a working directory reference number
  10916.           (instead of the volume reference number) if, in the last call
  10917.           to PBSetVol or PBHSetVol, a working directory reference number
  10918.           was passed in this field.
  10919.  
  10920.     The volume reference number of the volume on which the default
  10921. directory exists is returned in ioWDVRefNum. The directory ID of the
  10922. default directory is returned in ioWDDirID.
  10923.  
  10924. Result codes    noErr   No error
  10925.                 nsvErr  No default volume
  10926. \ PBSetVol
  10927. 17
  10928. FUNCTION PBSetVol (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  10929.  
  10930. Trap macro  _SetVol
  10931.  
  10932. Parameter block
  10933.     —>  12  ioCompletion    pointer
  10934.     <—  16  ioResult        word
  10935.     —>  18  ioNamePtr       pointer
  10936.     —>  22  ioVRefNum       word
  10937.  
  10938.     PBSetVol sets the default volume to the mounted volume specified by
  10939. ioNamePtr or ioVRefNum. On hierarchical volumes, PBSetVol also sets the
  10940. root directory as the default directory.
  10941.  
  10942. Result codes    noErr       No error
  10943.                 bdNamErr    Bad volume name
  10944.                 nsvErr      No such volume
  10945.                 paramErr    No default volume
  10946. \ PBHSetVol
  10947. 17
  10948. FUNCTION PBHSetVol (paramBlock: WDPBPtr; async: BOOLEAN) : OSErr;
  10949.  
  10950. Trap macro  _HSetVol
  10951.  
  10952. Parameter block
  10953.     —>  12  ioCompletion    pointer
  10954.     <—  16  ioResult        word
  10955.     —>  18  ioNamePtr       pointer
  10956.     —>  22  ioVRefNum       word
  10957.     —>  48  ioWDDirID       long word
  10958.  
  10959.     PBHSetVol sets both the default volume and the default directory.
  10960. The default directory to be used can be specified by either a volume
  10961. reference number or a working directory reference number in ioVRefNum, a
  10962. directory ID in ioWDDirID, or a pointer to a pathname (possibly NIL) in
  10963. ioNamePtr.
  10964.  
  10965. Note:  Both the default volume and  the default directory are used in
  10966.        calls made with no volume name and a volume reference number of
  10967.        zero.
  10968.  
  10969. Result codes    noErr   No error
  10970.                 nsvErr  No default volume
  10971. \ PBFlushVol
  10972. 17
  10973. FUNCTION PBFlushVol (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  10974.  
  10975. Trap macro  _FlushVol
  10976.  
  10977. Parameter block
  10978.     —>  12  ioCompletion    pointer
  10979.     <—  16  ioResult        word
  10980.     —>  18  ioNamePtr       pointer
  10981.     —>  22  ioVRefNum       word
  10982.  
  10983.     On the volume specified by ioNamePtr or ioVRefNum, PBFlushVol writes
  10984. descriptive information about the volume, the contents of the associated
  10985. volume buffer, and all access path buffers for the volume (if they’ve
  10986. changed since the last time PBFlushVol was called).
  10987.  
  10988. Note:  The date and time of the last modification to the volume are set
  10989.        when the modification is made, not when the volume is flushed.
  10990.  
  10991. Result codes    noErr       No error
  10992.                 bdNamErr    Bad volume name
  10993.                 extFSErr    External file system
  10994.                 ioErr       I/O error
  10995.                 nsDrvErr    No such drive
  10996.                 nsvErr      No such volume
  10997.                 paramErr    No default volume
  10998. \ PBUnmountVol
  10999. 17
  11000. FUNCTION PBUnmountVol (paramBlock: ParmBlkPtr) : OSErr;
  11001.  
  11002. Trap macro  _UnmountVol
  11003.  
  11004. Parameter block
  11005.     <—  16  ioResult    word
  11006.     —>  18  ioNamePtr   pointer
  11007.     —>  22  ioVRefNum   word
  11008.  
  11009.     PBUnmountVol unmounts the volume specified by ioNamePtr or
  11010. ioVRefNum, by calling PBFlushVol to flush the volume, closing all open
  11011. files on the volume, and releasing the memory used for the volume.
  11012. PBUnmountVol is always executed synchronously.
  11013.  
  11014. Warning:  Don’t unmount the startup volume.
  11015.  
  11016. Note:  Unmounting a volume does not close working directories; to
  11017.        release the memory allocated to a working directory, call
  11018.        PBCloseWD.
  11019.  
  11020. Result codes    noErr       No error
  11021.                 bdNamErr    Bad volume name
  11022.                 extFSErr    External file system
  11023.                 ioErr       I/O error
  11024.                 nsDrvErr    No such drive
  11025.                 nsvErr      No such volume
  11026.                 paramErr    No default volume
  11027. \ PBOffLine
  11028. 17
  11029. FUNCTION PBOffLine (paramBlock: ParmBlkPtr) : OSErr;
  11030.  
  11031. Trap macro  _OffLine
  11032.  
  11033. Parameter block
  11034.     —>  12  ioCompletion    pointer
  11035.     <—  16  ioResult    word
  11036.     —>  18  ioNamePtr   pointer
  11037.     —>  22  ioVRefNum   word
  11038.  
  11039.     PBOffLine places off-line the volume specified by ioNamePtr or
  11040. ioVRefNum, by calling PBFlushVol to flush the volume and releasing all
  11041. the memory used for the volume except for the volume control block.
  11042. PBOffLine is always executed synchronously.
  11043.  
  11044. Result codes    noErr       No error
  11045.                 bdNamErr    Bad volume name
  11046.                 extFSErr    External file system
  11047.                 ioErr       I/O error
  11048.                 nsDrvErr    No such drive
  11049.                 nsvErr      No such volume
  11050.                 paramErr    No default volume
  11051. \ PBEject
  11052. 17
  11053. FUNCTION PBEject (paramBlock: ParmBlkPtr) : OSErr;
  11054.  
  11055. Trap macro  _Eject
  11056.  
  11057. Parameter block
  11058.     —>  12  ioCompletion    pointer
  11059.     <—  16  ioResult        word
  11060.     —>  18  ioNamePtr       pointer
  11061.     —>  22  ioVRefNum       word
  11062.  
  11063.     PBEject flushes the volume specified by ioNamePtr or ioVRefNum,
  11064. places it off-line, and then ejects the volume.
  11065. ________________________________________________________________________
  11066.  
  11067. Assembly-language note:  You may invoke the macro _Eject asynchronously;
  11068. the first part of the call is executed synchronously, and the actual
  11069. ejection is executed asynchronously.
  11070. ________________________________________________________________________
  11071. Result codes    noErr       No error
  11072.                 bdNamErr    Bad volume name
  11073.                 extFSErr    External file system
  11074.                 ioErr       I/O error
  11075.                 nsDrvErr    No such drive
  11076.                 nsvErr      No such volume
  11077.                 paramErr    No default volume
  11078. \ PBOpen
  11079. 17
  11080. FUNCTION PBOpen (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11081.  
  11082. Trap macro  _Open
  11083.  
  11084. Parameter block
  11085.     —>  12  ioCompletion    pointer
  11086.     <—  16  ioResult        word
  11087.     —>  18  ioNamePtr       pointer
  11088.     —>  22  ioVRefNum       word
  11089.     <—  24  ioRefNum        word
  11090.     —>  26  ioVersNum       byte
  11091.     —>  27  ioPermssn       byte
  11092.     —>  28  ioMisc          pointer
  11093.  
  11094.     PBOpen creates an access path to the file having the name pointed to
  11095. by ioNamePtr (and on flat volumes, the version number ioVersNum) on the
  11096. volume specified by ioVRefNum. A path reference number is returned in
  11097. ioRefNum.
  11098.  
  11099.     IOMisc either points to a portion of memory (522 bytes) to be used
  11100. as the access path’s buffer, or is NIL if you want the volume buffer to
  11101. be used instead.
  11102.  
  11103. Warning:  All access paths to a single file that’s opened multiple times
  11104.           should share the same buffer so that they will read and write
  11105.           the same data.
  11106.  
  11107.     IOPermssn specifies the path’s read/write permission. A path can be
  11108. opened for writing even if it accesses a file on a locked volume, and an
  11109. error won’t be returned until a PBWrite, PBSetEOF, or PBAllocate call is
  11110. made.
  11111.  
  11112.     If you attempt to open a locked file for writing, PBOpen will return
  11113. permErr as its function result. If you request exclusive read/write
  11114. permission but another access path already has write permission (whether
  11115. write only, exclusive read/write, or shared read/write), PBOpen will
  11116. return the reference number of the existing access path in ioRefNum and
  11117. opWrErr as its function result. Similarly, if you request shared
  11118. read/write permission but another access path already has exclusive
  11119. read/write permission, PBOpen will return the reference number of the
  11120. access path in ioRefNum and opWrErr as its function result.
  11121.  
  11122. Result codes    noErr       No error
  11123.                 bdNamErr    Bad file name
  11124.                 extFSErr    External file system
  11125.                 fnfErr      File not found
  11126.                 ioErr       I/O error
  11127.                 nsvErr      No such volume
  11128.                 opWrErr     File already open for writing
  11129.                 permErr     Attempt to open locked file for writing
  11130.                 tmfoErr     Too many files open
  11131. \ PBHOpen
  11132. 17
  11133. FUNCTION PBHOpen (paramBlock: HParmBlkPtr; async: BOOLEAN) : OSErr;
  11134.  
  11135. Trap macro  _HOpen
  11136.  
  11137. Parameter block
  11138.     —>  12  ioCompletion    pointer
  11139.     <—  16  ioResult        word
  11140.     —>  18  ioNamePtr       pointer
  11141.     —>  22  ioVRefNum       word
  11142.     <—  24  ioRefNum        word
  11143.     —>  27  ioPermssn       byte
  11144.     —>  28  ioMisc          pointer
  11145.     —>  48  ioDirID         long word
  11146.  
  11147.     PBHOpen is identical to PBOpen except that it accepts a directory ID
  11148. in ioDirID.
  11149.  
  11150. Result codes    noErr       No error
  11151.                 bdNamErr    Bad file name
  11152.                 dirNFErr    Directory not found or incomplete pathname
  11153.                 extFSErr    External file system
  11154.                 fnfErr      File not found
  11155.                 ioErr       I/O error
  11156.                 nsvErr      No such volume
  11157.                 opWrErr     File already open for writing
  11158.                 permErr     Attempt to open locked file for writing
  11159.                 tmfoErr     Too many files open
  11160.  
  11161. \ PBOpenRF
  11162. 17
  11163. FUNCTION PBOpenRF (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11164.  
  11165. Trap macro  _OpenRF
  11166.  
  11167. Parameter block
  11168.     —>  12  ioCompletion    pointer
  11169.     <—  16  ioResult        word
  11170.     —>  18  ioNamePtr       pointer
  11171.     —>  22  ioVRefNum       word
  11172.     <—  24  ioRefNum        word
  11173.     —>  26  ioVersNum       byte
  11174.     —>  27  ioPermssn       byte
  11175.     —>  28  ioMisc          pointer
  11176.  
  11177.     PBOpenRF is identical to PBOpen, except that it opens the file’s
  11178. resource fork instead of its data fork.
  11179.  
  11180. Note:  Normally you should access a file’s resource fork through the
  11181.        routines of the Resource Manager rather than the File Manager.
  11182.        PBOpenRF doesn’t read the resource map into memory; it’s really
  11183.        only useful for block-level operations such as copying files.
  11184.  
  11185. Result codes    noErr       No error
  11186.                 bdNamErr    Bad file name
  11187.                 extFSErr    External file system
  11188.                 fnfErr      File not found
  11189.                 ioErr       I/O error
  11190.                 nsvErr      No such volume
  11191.                 opWrErr     File already open for writing
  11192.                 permErr     Attempt to open locked file for writing
  11193.                 tmfoErr     Too many files open
  11194. \ PBHOpenRF
  11195. 17
  11196. FUNCTION PBHOpenRF (paramBlock: HParmBlkPtr; async: BOOLEAN) : OSErr;
  11197.  
  11198. Trap macro  _HOpenRF
  11199.  
  11200. Parameter block
  11201.     —>  12  ioCompletion    pointer
  11202.     <—  16  ioResult        word
  11203.     —>  18  ioNamePtr       pointer
  11204.     —>  22  ioVRefNum       word
  11205.     <—  24  ioRefNum        word
  11206.     —>  27  ioPermssn       byte
  11207.     —>  28  ioMisc          pointer
  11208.     —>  48  ioDirID         long word
  11209.  
  11210.     PBHOpenRF is identical to PBOpenRF except that it accepts a
  11211. directory ID in ioDirID.
  11212.  
  11213. Result codes    noErr       No error
  11214.                 bdNamErr    Bad file name
  11215.                 dirNFErr    Directory not found or incomplete pathname
  11216.                 extFSErr    External file system
  11217.                 fnfErr      File not found
  11218.                 ioErr       I/O error
  11219.                 nsvErr      No such volume
  11220.                 opWrErr     File already open for writing
  11221.                 permErr     Attempt to open locked file for writing
  11222.                 tmfoErr     Too many files open
  11223. \ PBLockRange
  11224. 17
  11225. FUNCTION PBLockRange (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11226.  
  11227. Trap macro  _LockRng
  11228.  
  11229. Parameter block
  11230.     —>  12  ioCompletion    pointer
  11231.     <—  16  ioResult        word
  11232.     —>  24  ioRefNum        word
  11233.     —>  36  ioReqCount      long word
  11234.     —>  44  ioPosMode       word
  11235.     —>  46  ioPosOffset     long word
  11236.  
  11237.     On a file opened with a shared read/write permission, PBLockRange is
  11238. used in conjunction with PBRead and PBWrite to lock a certain portion of
  11239. the file. PBLockRange uses the same parameters as both PBRead and
  11240. PBWrite; by calling it immediately before PBRead, you can use the
  11241. information present in the parameter block for the PBRead call.
  11242.  
  11243.     When you’re finished with the data (typically after a call to
  11244. PBWrite), be sure to call PBUnlockRange to free up that portion of the
  11245. file for subsequent PBRead calls.
  11246.  
  11247. Warning:  PBLockRange operates only with the hierarchical version of the
  11248.           File Manager; if used on a Macintosh equipped only with the
  11249.           64K ROM version of the File Manager, it will generate a system
  11250.           error.
  11251.  
  11252. Result codes    noErr       No error
  11253.                 eofErr      End-of-file
  11254.                 extFSErr    External file system
  11255.                 fnOpnErr    File not open
  11256.                 ioErr       I/O error
  11257.                 paramErr    Negative ioReqCount
  11258.                 rfNumErr    Bad reference number
  11259. \ PBUnlockRange
  11260. 17
  11261. FUNCTION PBUnlockRange (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11262.  
  11263. Trap macro  _UnlockRng
  11264.  
  11265. Parameter block
  11266.     —>  12  ioCompletion    pointer
  11267.     <—  16  ioResult        word
  11268.     —>  24  ioRefNum        word
  11269.     —>  36  ioReqCount      long word
  11270.     —>  44  ioPosMode       word
  11271.     —>  46  ioPosOffset     long word
  11272.  
  11273.     PBUnlockRange is used in conjunction with PBRead and PBWrite to
  11274. unlock a certain portion of a file that you locked with PBLockRange.
  11275. PBUnlockRange uses the same parameters as both PBRead and PBWrite; by
  11276. calling it immediately after PBWrite, you can use the information
  11277. present in the parameter block to unlock the portion of the file that
  11278. was just written.
  11279.  
  11280. Warning:  PBUnlockRange operates only with the hierarchical version of
  11281.           the File Manager; if used on a Macintosh equipped only with
  11282.           the 64K ROM version of the File Manager, it will generate a
  11283.           system error.
  11284.  
  11285. Result codes    noErr       No error
  11286.                 eofErr      End-of-file
  11287.                 extFSErr    External file system
  11288.                 fnOpnErr    File not open
  11289.                 ioErr       I/O error
  11290.                 paramErr    Negative ioReqCount
  11291.                 rfNumErr    Bad reference number
  11292. \ PBRead
  11293. 17
  11294. FUNCTION PBRead (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11295.  
  11296. Trap macro  _Read
  11297.  
  11298. Parameter block
  11299.     —>  12  ioCompletion    pointer
  11300.     <—  16  ioResult        word
  11301.     —>  24  ioRefNum        word
  11302.     —>  32  ioBuffer        pointer
  11303.     —>  36  ioReqCount      long word
  11304.     <—  40  ioActCount      long word
  11305.     —>  44  ioPosMode       word
  11306.     <–> 46  ioPosOffset     long word
  11307.  
  11308.     PBRead attempts to read ioReqCount bytes from the open file whose
  11309. access path is specified by ioRefNum, and transfer them to the data
  11310. buffer pointed to by ioBuffer. The position of the mark is specified by
  11311. ioPosMode and ioPosOffset. If you try to read past the logical
  11312. end-of-file, PBRead moves the mark to the end-of-file and returns eofErr
  11313. as its function result. After the read is completed, the mark is
  11314. returned in ioPosOffset and the number of bytes actually read is
  11315. returned in ioActCount.
  11316.  
  11317. Result codes    noErr       No error
  11318.                 eofErr      End-of-file
  11319.                 extFSErr    External file system
  11320.                 fnOpnErr    File not open
  11321.                 ioErr       I/O error
  11322.                 paramErr    Negative ioReqCount
  11323.                 rfNumErr    Bad reference number
  11324. \ PBWrite
  11325. 17
  11326. FUNCTION PBWrite (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11327.  
  11328. Trap macro  _Write
  11329.  
  11330. Parameter block
  11331.     —>  12  ioCompletion    pointer
  11332.     <—  16  ioResult        word
  11333.     —>  24  ioRefNum        word
  11334.     —>  32  ioBuffer        pointer
  11335.     —>  36  ioReqCount      long word
  11336.     <—  40  ioActCount      long word
  11337.     —>  44  ioPosMode       word
  11338.     <–> 46  ioPosOffset     long word
  11339.  
  11340.     PBWrite takes ioReqCount bytes from the buffer pointed to by
  11341. ioBuffer and attempts to write them to the open file whose access path
  11342. is specified by ioRefNum. The position of the mark is specified by
  11343. ioPosMode and ioPosOffset. After the write is completed, the mark is
  11344. returned in ioPosOffset and the number of bytes actually written is
  11345. returned in ioActCount.
  11346.  
  11347. Result codes    noErr       No error
  11348.                 dskFulErr   Disk full
  11349.                 fLckdErr    File locked
  11350.                 fnOpnErr    File not open
  11351.                 ioErr       I/O error
  11352.                 paramErr    Negative ioReqCount
  11353.                 posErr      Attempt to position before start of file
  11354.                 rfNumErr    Bad reference number
  11355.                 vLckdErr    Software volume lock
  11356.                 wPrErr      Hardware volume lock
  11357.                 wrPermErr   Read/write permission doesn’t allow writing
  11358. \ PBGetFPos
  11359. 17
  11360. FUNCTION PBGetFPos (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11361.  
  11362. Trap macro  _GetFPos
  11363.  
  11364. Parameter block
  11365.     —>  12  ioCompletion    pointer
  11366.     <—  16  ioResult        word
  11367.     —>  24  ioRefNum        word
  11368.     <—  36  ioReqCount      long word
  11369.     <—  40  ioActCount      long word
  11370.     <—  44  ioPosMode       word
  11371.     <—  46  ioPosOffset     long word
  11372.  
  11373.     PBGetFPos returns, in ioPosOffset, the mark of the open file whose
  11374. access path is specified by ioRefNum. It sets ioReqCount, ioActCount,
  11375. and ioPosMode to 0.
  11376.  
  11377. Result codes    noErr       No error
  11378.                 extFSErr    External file system
  11379.                 fnOpnErr    File not open
  11380.                 gfpErr      Error during GetFPos
  11381.                 ioErr       I/O error
  11382.                 rfNumErr    Bad reference number
  11383. \ PBSetFPos
  11384. 17
  11385. FUNCTION PBSetFPos (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11386.  
  11387. Trap macro  _SetFPos
  11388.  
  11389. Parameter block
  11390.     —>  12  ioCompletion    pointer
  11391.     <—  16  ioResult        word
  11392.     —>  24  ioRefNum        word
  11393.     —>  44  ioPosMode       word
  11394.     <–> 46  ioPosOffset     long word
  11395.  
  11396.     PBSetFPos sets the mark of the open file whose access path is
  11397. specified by ioRefNum to the position specified by ioPosMode and
  11398. ioPosOffset. The position at which the mark is actually set is returned
  11399. in ioPosOffset. If you try to set the mark past the logical
  11400. end-of-file, PBSetFPos moves the mark to the end-of-file and returns
  11401. eofErr as its function result.
  11402.  
  11403. Result codes    noErr       No error
  11404.                 eofErr      End-of-file
  11405.                 extFSErr    External file system
  11406.                 fnOpnErr    File not open
  11407.                 ioErr       I/O error
  11408.                 posErr      Attempt to position before start of file
  11409.                 rfNumErr    Bad reference number
  11410. \ PBGetEOF
  11411. 17
  11412. FUNCTION PBGetEOF (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11413.  
  11414. Trap macro  _GetEOF
  11415.  
  11416. Parameter block
  11417.     —>  12  ioCompletion    pointer
  11418.     <—  16  ioResult        word
  11419.     —>  24  ioRefNum        word
  11420.     <—  28  ioMisc          long word
  11421.  
  11422.     PBGetEOF returns, in ioMisc, the logical end-of-file of the open
  11423. file whose access path is specified by ioRefNum.
  11424.  
  11425. Result codes    noErr       No error
  11426.                 extFSErr    External file system
  11427.                 fnOpnErr    File not open
  11428.                 ioErr       I/O error
  11429.                 rfNumErr    Bad reference number
  11430. \ PBSetEOF
  11431. 17
  11432. FUNCTION PBSetEOF (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11433.  
  11434. Trap macro  _SetEOF
  11435.  
  11436. Parameter block
  11437.     —>  12  ioCompletion    pointer
  11438.     <—  16  ioResult        word
  11439.     —>  24  ioRefNum        word
  11440.     —>  28  ioMisc          long word
  11441.  
  11442.     PBSetEOF sets the logical end-of-file of the open file, whose access
  11443. path is specified by ioRefNum, to ioMisc. If you attempt to set the
  11444. logical end-of-file beyond the physical end-of-file, another allocation
  11445. block is added to the file; if there isn’t enough space on the volume,
  11446. no change is made, and PBSetEOF returns dskFulErr as its function
  11447. result. If ioMisc is 0, all space occupied by the file on the volume is
  11448. released.
  11449.  
  11450. Result codes    noErr       No error
  11451.                 dskFulErr   Disk full
  11452.                 extFSErr    External file system
  11453.                 fLckdErr    File locked
  11454.                 fnOpnErr    File not open
  11455.                 ioErr       I/O error
  11456.                 rfNumErr    Bad reference number
  11457.                 vLckdErr    Software volume lock
  11458.                 wPrErr      Hardware volume lock
  11459.                 wrPermErr   Read/write permission doesn’t allow writing
  11460. \ PBAllocate
  11461. 17
  11462. FUNCTION PBAllocate (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11463.  
  11464. Trap macro  _Allocate
  11465.  
  11466. Parameter block
  11467.     —>  12  ioCompletion    pointer
  11468.     <—  16  ioResult        word
  11469.     —>  24  ioRefNum        word
  11470.     —>  36  ioReqCount      long word
  11471.     <—  40  ioActCount      long word
  11472.  
  11473.     PBAllocate adds ioReqCount bytes to the open file whose access path
  11474. is specified by ioRefNum, and sets the physical end-of-file to one byte
  11475. beyond the last block allocated. The number of bytes actually allocated
  11476. is rounded up to the nearest multiple of the allocation block size, and
  11477. returned in ioActCount. If there isn’t enough empty space on the volume
  11478. to satisfy the allocation request, PBAllocate allocates the rest of the
  11479. space on the volume and returns dskFulErr as its function result.
  11480.  
  11481. Note:  Even if the total number of requested bytes is unavailable,
  11482.        PBAllocate will allocate whatever space, contiguous or not, is
  11483.        available. To force the allocation of the entire requested space
  11484.        as a contiguous piece, call PBAllocContig instead.
  11485.  
  11486. Result codes    noErr       No error
  11487.                 dskFulErr   Disk full
  11488.                 fLckdErr    File locked
  11489.                 fnOpnErr    File not open
  11490.                 ioErr       I/O error
  11491.                 rfNumErr    Bad reference number
  11492.                 vLckdErr    Software volume lock
  11493.                 wPrErr      Hardware volume lock
  11494.                 wrPermErr   Read/write permission doesn’t allow writing
  11495. \ PBAllocContig
  11496. 17
  11497. FUNCTION PBAllocContig (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11498.  
  11499. Trap macro  _AllocContig
  11500.  
  11501. Parameter block
  11502.     —>  12  ioCompletion    pointer
  11503.     <—  16  ioResult        word
  11504.     —>  24  ioRefNum        word
  11505.     —>  36  ioReqCount      long word
  11506.     <—  40  ioActCount      long word
  11507.  
  11508.     PBAllocContig is identical to PBAllocate except that if there isn’t
  11509. enough contiguous empty space on the volume to satisfy the allocation
  11510. request, PBAllocContig will do nothing and will return dskFulErr as its
  11511. function result. If you want to allocate whatever space is available,
  11512. even when the entire request cannot be filled as a contiguous piece,
  11513. call PBAllocate instead.
  11514.  
  11515. Result codes    noErr       No error
  11516.                 dskFulErr   Disk full
  11517.                 fLckdErr    File locked
  11518.                 fnOpnErr    File not open
  11519.                 ioErr       I/O error
  11520.                 rfNumErr    Bad reference number
  11521.                 vLckdErr    Software volume lock
  11522.                 wPrErr      Hardware volume lock
  11523.                 wrPermErr   Read/write permission doesn’t allow writing
  11524. \ PBFlushFile
  11525. 17
  11526. FUNCTION PBFlushFile (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11527.  
  11528. Trap macro  _FlushFile
  11529.  
  11530. Parameter block
  11531.     —>  12  ioCompletion    pointer
  11532.     <—  16  ioResult        word
  11533.     —>  24  ioRefNum        word
  11534.  
  11535.     PBFlushFile writes the contents of the access path buffer indicated
  11536. by ioRefNum to the volume, and updates the file’s entry in the file
  11537. directory (or in the file catalog, in the case of hierarchical volumes).
  11538.  
  11539. Warning:  Some information stored on the volume won’t be correct until
  11540.           PBFlushVol is called.
  11541.  
  11542. Result codes    noErr       No error
  11543.                 extFSErr    External file system
  11544.                 fnfErr      File not found
  11545.                 fnOpnErr    File not open
  11546.                 ioErr       I/O error
  11547.                 nsvErr      No such volume
  11548.                 rfNumErr    Bad reference number
  11549.  
  11550. \ PBClose
  11551. 17
  11552. FUNCTION PBClose (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11553.  
  11554. Trap macro  _Close
  11555.  
  11556. Parameter block
  11557.     —>  12  ioCompletion    pointer
  11558.     <—  16  ioResult        word
  11559.     —>  24  ioRefNum        word
  11560.  
  11561.     PBClose writes the contents of the access path buffer specified by
  11562. ioRefNum to the volume and removes the access path.
  11563.  
  11564. Warning:  Some information stored on the volume won’t be correct until
  11565.           PBFlushVol is called.
  11566.  
  11567. Result codes    noErr       No error
  11568.                 extFSErr    External file system
  11569.                 fnfErr      File not found
  11570.                 fnOpnErr    File not open
  11571.                 ioErr       I/O error
  11572.                 nsvErr      No such volume
  11573.                 rfNumErr    Bad reference number
  11574.  
  11575. \ PBCreate
  11576. 17
  11577. FUNCTION PBCreate (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11578.  
  11579. Trap macro  _Create
  11580.  
  11581. Parameter block
  11582.     —>  12  ioCompletion    pointer
  11583.     <—  16  ioResult        word
  11584.     —>  18  ioNamePtr       pointer
  11585.     —>  22  ioVRefNum       word
  11586.     —>  26  ioFVersNum      byte
  11587.  
  11588.     PBCreate creates a new file (both forks) having the name pointed to
  11589. by ioNamePtr (and on flat volumes, the version number ioVersNum) on the
  11590. volume specified by ioVRefNum. The new file is unlocked and empty. The
  11591. date and time of its creation and last modification are set to the
  11592. current date and time. If the file created isn’t temporary (that is, if
  11593. it will exist after the application terminates), the application should
  11594. call PBSetFInfo (after PBCreate) to fill in the information needed by
  11595. the Finder.
  11596. ________________________________________________________________________
  11597.  
  11598. Assembly-language note:  If a desk accessory creates a file, it should
  11599. always create it in the directory containing the system folder. The
  11600. working directory reference number for this directory is stored in the
  11601. global variable BootDrive; you can pass it in ioVRefNum.
  11602. ________________________________________________________________________
  11603.  
  11604. Result codes    noErr       No error
  11605.                 bdNamErr    Bad file name
  11606.                 dupFNErr    Duplicate file name and version
  11607.                 dirFulErr   File directory full
  11608.                 extFSErr    External file system
  11609.                 ioErr       I/O error
  11610.                 nsvErr      No such volume
  11611.                 vLckdErr    Software volume lock
  11612.                 wPrErr      Hardware volume lock
  11613. \ PBHCreate
  11614. 17
  11615. FUNCTION PBHCreate (paramBlock: HParmBlkPtr; async: BOOLEAN) : OSErr;
  11616.  
  11617. Trap macro  _HCreate
  11618.  
  11619. Parameter block
  11620.     —>  12  ioCompletion    pointer
  11621.     <—  16  ioResult        word
  11622.     —>  18  ioNamePtr       pointer
  11623.     —>  22  ioVRefNum       word
  11624.     —>  48  ioDirID         long word
  11625.  
  11626.     PBHCreate is identical to PBCreate except that it accepts a
  11627. directory ID in ioDirID.
  11628.  
  11629. Note:  To create a directory instead of a file, call PBDirCreate.
  11630.  
  11631. Result codes    noErr       No error
  11632.                 bdNamErr    Bad file name
  11633.                 dupFNErr    Duplicate file name and version
  11634.                 dirFulErr   File directory full
  11635.                 dirNFErr    Directory not found or incomplete pathname
  11636.                 extFSErr    External file system
  11637.                 ioErr       I/O error
  11638.                 nsvErr      No such volume
  11639.                 vLckdErr    Software volume lock
  11640.                 wPrErr      Hardware volume lock
  11641. \ PBDirCreate
  11642. 17
  11643. FUNCTION PBDirCreate (paramBlock: HParmBlkPtr; async: BOOLEAN): OSErr;
  11644.  
  11645. Trap macro  _DirCreate
  11646.  
  11647. Parameter block
  11648.     —>  12  ioCompletion    pointer
  11649.     <—  16  ioResult        word
  11650.     <–> 18  ioNamePtr       pointer
  11651.     —>  22  ioVRefNum       word
  11652.     <–> 48  ioDirID         long word
  11653.  
  11654.     PBDirCreate is identical to PBHCreate except that it creates a new
  11655. directory instead of a file. You can specify the parent of the
  11656. directory to be created in ioDirID; if it’s 0, the new directory will be
  11657. placed in the root directory. The directory ID of the new directory is
  11658. returned in ioDirID.
  11659.  
  11660. Warning:  PBDirCreate operates only with the hierarchical version of the
  11661.           File Manager; if used on a Macintosh equipped only with the
  11662.           64K ROM version of the File Manager, it will generate a system
  11663.           error.
  11664.  
  11665. Result codes    noErr       No error
  11666.                 bdNamErr    Bad file name
  11667.                 dupFNErr    Duplicate file name and version
  11668.                 dirFulErr   File directory full
  11669.                 dirNFErr    Directory not found or incomplete pathname
  11670.                 extFSErr    External file system
  11671.                 ioErr       I/O error
  11672.                 nsvErr      No such volume
  11673.                 vLckdErr    Software volume lock
  11674.                 wPrErr      Hardware volume lock
  11675.  
  11676. \ PBDelete
  11677. 17
  11678. FUNCTION PBDelete (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11679.  
  11680. Trap macro  _Delete
  11681.  
  11682. Parameter block
  11683.     —>  12  ioCompletion    pointer
  11684.     <—  16  ioResult        word
  11685.     —>  18  ioNamePtr       pointer
  11686.     —>  22  ioVRefNum       word
  11687.     —>  26  ioFVersNum      byte
  11688.  
  11689.     PBDelete removes the closed file having the name pointed to by
  11690. ioNamePtr (and on flat volumes, the version number ioVersNum) from the
  11691. volume pointed to by ioVRefNum. PBHDelete can be used to delete an
  11692. empty directory as well.
  11693.  
  11694. Note:  This function will delete both forks of the file.
  11695.  
  11696. Result codes    noErr       No error
  11697.                 bdNamErr    Bad file name
  11698.                 extFSErr    External file system
  11699.                 fBsyErr     File busy, directory not empty, or working
  11700.                             directory control block open
  11701.                 fLckdErr    File locked
  11702.                 fnfErr      File not found
  11703.                 nsvErr      No such volume
  11704.                 ioErr       I/O error
  11705.                 vLckdErr    Software volume lock
  11706.                 wPrErr      Hardware volume lock
  11707. \ PBHDelete
  11708. 17
  11709. FUNCTION PBHDelete (paramBlock: HParmBlkPtr; async: BOOLEAN) : OSErr;
  11710.  
  11711. Trap macro  _HDelete
  11712.  
  11713. Parameter block
  11714.     —>  12  ioCompletion    pointer
  11715.     <—  16  ioResult        word
  11716.     —>  18  ioNamePtr       pointer
  11717.     —>  22  ioVRefNum       word
  11718.     —>  48  ioDirID         long word
  11719.  
  11720.     PBHDelete is identical to PBDelete except that it accepts a
  11721. directory ID in ioDirID. PBHDelete can be used to delete an empty
  11722. directory as well.
  11723.  
  11724. Result codes    noErr       No error
  11725.                 bdNamErr    Bad file name
  11726.                 dirNFErr    Directory not found or incomplete pathname
  11727.                 extFSErr    External file system
  11728.                 fBsyErr     File busy, directory not empty,
  11729.                             or working directory control block open
  11730.                 fLckdErr    File locked
  11731.                 fnfErr      File not found
  11732.                 nsvErr      No such volume
  11733.                 ioErr       I/O error
  11734.                 vLckdErr    Software volume lock
  11735.                 wPrErr      Hardware volume lock
  11736. \ PBGetFInfo
  11737. 17
  11738. FUNCTION PBGetFInfo (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11739.  
  11740. Trap macro  _GetFileInfo
  11741.  
  11742. Parameter block
  11743.     —>  12  ioCompletion    pointer
  11744.     <—  16  ioResult        word
  11745.     <–> 18  ioNamePtr       pointer
  11746.     —>  22  ioVRefNum       word
  11747.     <—  24  ioFRefNum       word
  11748.     —>  26  ioFVersNum      byte
  11749.     —>  28  ioFDirIndex     word
  11750.     <—  30  ioFlAttrib      byte
  11751.     <—  31  ioFlVersNum     byte
  11752.     <—  32  ioFlFndrInfo    16 bytes
  11753.     <—  48  ioFlNum         long word
  11754.     <—  52  ioFlStBlk       word
  11755.     <—  54  ioFlLgLen       long word
  11756.     <—  58  ioFlPyLen       long word
  11757.     <—  62  ioFlRStBlk      word
  11758.     <—  64  ioFlRLgLen      long word
  11759.     <—  68  ioFlRPyLen      long word
  11760.     <—  72  ioFlCrDat       long word
  11761.     <—  76  ioFlMdDat       long word
  11762.  
  11763.     PBGetFInfo returns information about the specified file. If
  11764. ioFDirIndex is positive, the File Manager returns information about the
  11765. file whose directory index is ioFDirIndex on the volume specified by
  11766. ioVRefNum. (See the section “Data Organization on Volumes” if you’re
  11767. interested in using this method.)
  11768.  
  11769. Note:  If a working directory reference number is specified in
  11770.        ioVRefNum, the File Manager returns information about the file
  11771.        whose directory index is ioFDirIndex in the specified directory.
  11772.  
  11773.     If ioFDirIndex is negative or 0, the File Manager returns
  11774. information about the file having the name pointed to by ioNamePtr (and
  11775. on flat volumes, the version number ioFVersNum) on the volume specified
  11776. by ioVRefNum. If the file is open, the reference number of the first
  11777. access path found is returned in ioFRefNum, and the name of the file is
  11778. returned in ioNamePtr (unless ioNamePtr is NIL).
  11779.  
  11780. Result codes    noErr       No error
  11781.                 bdNamErr    Bad file name
  11782.                 extFSErr    External file system
  11783.                 fnfErr      File not found
  11784.                 ioErr       I/O error
  11785.                 nsvErr      No such volume
  11786.                 paramErr    No default volume
  11787. \ PBHGetFInfo
  11788. 17
  11789. FUNCTION PBHGetFInfo (paramBlock: HParmBlkPtr; async: BOOLEAN) : OSErr;
  11790.  
  11791. Trap macro  _HGetFileInfo
  11792.  
  11793. Parameter block
  11794.     —>  12  ioCompletion    pointer
  11795.     <—  16  ioResult        word
  11796.     <–> 18  ioNamePtr       pointer
  11797.     —>  22  ioVRefNum       word
  11798.     <—  24  ioFRefNum       word
  11799.     —>  28  ioFDirIndex     word
  11800.     <—  30  ioFlAttrib      byte
  11801.     <—  32  ioFlFndrInfo    16 bytes
  11802.     <–> 48  ioDirID         long word
  11803.     <—  52  ioFlStBlk       word
  11804.     <—  54  ioFlLgLen       long word
  11805.     <—  58  ioFlPyLen       long word
  11806.     <—  62  ioFlRStBlk      word
  11807.     <—  64  ioFlRLgLen      long word
  11808.     <—  68  ioFlRPyLen      long word
  11809.     <—  72  ioFlCrDat       long word
  11810.     <—  76  ioFlMdDat       long word
  11811.  
  11812.     PBHGetFInfo is identical to PBGetFInfo except that it accepts a
  11813. directory ID in ioDirID.
  11814.  
  11815. Result codes    noErr       No error
  11816.                 bdNamErr    Bad file name
  11817.                 dirNFErr    Directory not found or incomplete pathname
  11818.                 extFSErr    External file system
  11819.                 fnfErr      File not found
  11820.                 ioErr       I/O error
  11821.                 nsvErr      No such volume
  11822.                 paramErr    No default volume
  11823. \ PBSetFInfo
  11824. 17
  11825. FUNCTION PBSetFInfo (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11826.  
  11827. Trap macro  _SetFileInfo
  11828.  
  11829. Parameter block
  11830.     —>  12  ioCompletion    pointer
  11831.     <—  16  ioResult        word
  11832.     —>  18  ioNamePtr       pointer
  11833.     —>  22  ioVRefNum       word
  11834.     —>  26  ioFVersNum      byte
  11835.     —>  32  ioFlFndrInfo    16 bytes
  11836.     —>  72  ioFlCrDat       long word
  11837.     —>  76  ioFlMdDat       long word
  11838.  
  11839.     PBSetFInfo sets information (including the date and time of creation
  11840. and modification, and information needed by the Finder) about the file
  11841. having the name pointed to by ioNamePtr (and on flat volumes, the
  11842. version number ioFVersNum) on the volume specified by ioVRefNum. You
  11843. should call PBGetFInfo just before PBSetFInfo, so the current
  11844. information is present in the parameter block.
  11845.  
  11846. Result codes    noErr       No error
  11847.                 bdNamErr    Bad file name
  11848.                 extFSErr    External file system
  11849.                 fLckdErr    File locked
  11850.                 fnfErr      File not found
  11851.                 ioErr       I/O error
  11852.                 nsvErr      No such volume
  11853.                 vLckdErr    Software volume lock
  11854.                 wPrErr      Hardware volume lock
  11855. \ PBHSetFInfo
  11856. 17
  11857. FUNCTION PBHSetFInfo (paramBlock: HParmBlkPtr; async: BOOLEAN) : OSErr;
  11858.  
  11859. Trap macro  _HSetFileInfo
  11860.  
  11861. Parameter block
  11862.     —>  12  ioCompletion    pointer
  11863.     <—  16  ioResult        word
  11864.     —>  18  ioNamePtr       pointer
  11865.     —>  22  ioVRefNum       word
  11866.     —>  32  ioFlFndrInfo    16 bytes
  11867.     —>  48  ioDirID         long word
  11868.     —>  72  ioFlCrDat       long word
  11869.     —>  76  ioFlMdDat       long word
  11870.  
  11871.     PBHSetFInfo is identical to PBSetFInfo except that it accepts a
  11872. directory ID in ioDirID.
  11873.  
  11874. Result codes    noErr       No error
  11875.                 bdNamErr    Bad file name
  11876.                 dirNFErr    Directory not found or incomplete pathname
  11877.                 extFSErr    External file system
  11878.                 fLckdErr    File locked
  11879.                 fnfErr      File not found
  11880.                 ioErr       I/O error
  11881.                 nsvErr      No such volume
  11882.                 vLckdErr    Software volume lock
  11883.                 wPrErr      Hardware volume lock
  11884. \ PBSetFLock
  11885. 17
  11886. FUNCTION PBSetFLock (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11887.  
  11888. Trap macro  _SetFilLock
  11889.  
  11890. Parameter block
  11891.     —>  12  ioCompletion    pointer
  11892.     <—  16  ioResult        word
  11893.     —>  18  ioNamePtr       pointer
  11894.     —>  22  ioVRefNum       word
  11895.     —>  26  ioFVersNum      byte
  11896.  
  11897.     PBSetFLock locks the file having the name pointed to by ioNamePtr
  11898. (and on flat volumes, the version number ioFVersNum) on the volume
  11899. specified by ioVRefNum. Access paths currently in use aren’t affected.
  11900.  
  11901. Result codes    noErr       No error
  11902.                 extFSErr    External file system
  11903.                 fnfErr      File not found
  11904.                 ioErr       I/O error
  11905.                 nsvErr      No such volume
  11906.                 vLckdErr    Software volume lock
  11907.                 wPrErr      Hardware volume lock
  11908.  
  11909. \ PBHSetFLock
  11910. 17
  11911. FUNCTION PBHSetFLock (paramBlock: HParmBlkPtr; async: BOOLEAN) : OSErr;
  11912.  
  11913. Trap macro  _HSetFLock
  11914.  
  11915. Parameter block
  11916.     —>  12  ioCompletion    pointer
  11917.     <—  16  ioResult        word
  11918.     —>  18  ioNamePtr       pointer
  11919.     —>  22  ioVRefNum       word
  11920.     —>  48  ioDirID         long word
  11921.  
  11922.     PBHSetFLock is identical to PBSetFLock except that it accepts a
  11923. directory ID in ioDirID.
  11924.  
  11925. Result codes    noErr       No error
  11926.                 dirNFErr    Directory not found or incomplete pathname
  11927.                 extFSErr    External file system
  11928.                 fnfErr      File not found
  11929.                 ioErr       I/O error
  11930.                 nsvErr      No such volume
  11931.                 vLckdErr    Software volume lock
  11932.                 wPrErr      Hardware volume lock
  11933. \ PBRstFLock
  11934. 17
  11935. FUNCTION PBRstFLock (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11936.  
  11937. Trap macro  _RstFilLock
  11938.  
  11939. Parameter block
  11940.     —>  12  ioCompletion    pointer
  11941.     <—  16  ioResult        word
  11942.     —>  18  ioNamePtr       pointer
  11943.     —>  22  ioVRefNum       word
  11944.     —>  26  ioFVersNum      byte
  11945.  
  11946.     PBRstFLock unlocks the file having the name pointed to by ioNamePtr
  11947. (and on flat volumes, the version number ioFVersNum) on the volume
  11948. specified by ioVRefNum. Access paths currently in use aren’t affected.
  11949.  
  11950. Result codes    noErr       No error
  11951.                 extFSErr    External file system
  11952.                 fnfErr      File not found
  11953.                 ioErr       I/O error
  11954.                 nsvErr      No such volume
  11955.                 vLckdErr    Software volume lock
  11956.                 wPrErr      Hardware volume lock
  11957.  
  11958. \ PBHRstFLock
  11959. 17
  11960. FUNCTION PBHRstFLock (paramBlock: HParmBlkPtr; async: BOOLEAN) : OSErr;
  11961.  
  11962. Trap macro  _HRstFLock
  11963.  
  11964. Parameter block
  11965.     —>  12  ioCompletion    pointer
  11966.     <—  16  ioResult        word
  11967.     —>  18  ioNamePtr       pointer
  11968.     —>  22  ioVRefNum       word
  11969.     —>  48  ioDirID         long word
  11970.  
  11971.     PBHRstFLock is identical to PBRstFLock except that it accepts a
  11972. directory ID in ioDirID.
  11973.  
  11974. Result codes    noErr       No error
  11975.                 dirNFErr    Directory not found or incomplete pathname
  11976.                 extFSErr    External file system
  11977.                 fnfErr      File not found
  11978.                 ioErr       I/O error
  11979.                 nsvErr      No such volume
  11980.                 vLckdErr    Software volume lock
  11981.                 wPrErr      Hardware volume lock
  11982.  
  11983. \ PBSetFVers
  11984. 17
  11985. FUNCTION PBSetFVers (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11986.  
  11987. Trap macro  _SetFilType
  11988.  
  11989. Parameter block
  11990.     —>  12  ioCompletion    pointer
  11991.     <—  16  ioResult        word
  11992.     —>  18  ioNamePtr       pointer
  11993.     —>  22  ioVRefNum       word
  11994.     —>  26  ioVersNum       byte
  11995.     —>  28  ioMisc          byte
  11996.  
  11997.     PBSetFVers has no effect on hierarchical volumes. On flat volumes,
  11998. PBSetFVers changes the version number of the file having the name
  11999. pointed to by ioNamePtr and version number ioVersNum, on the volume
  12000. specified by ioVRefNum, to the version number stored in the high-order
  12001. byte of ioMisc. Access paths currently in use aren’t affected.
  12002.  
  12003. Result codes    noErr           No error
  12004.                 bdNamErr        Bad file name
  12005.                 dupFNErr        Duplicate file name and version
  12006.                 extFSErr        External file system
  12007.                 fLckdErr        File locked
  12008.                 fnfErr          File not found
  12009.                 nsvErr          No such volume
  12010.                 ioErr           I/O error
  12011.                 paramErr        No default volume
  12012.                 vLckdErr        Software volume lock
  12013.                 wPrErr          Hardware volume lock
  12014.                 wrgVolTypErr    Attempt to perform hierarchical
  12015.                                 operation on a flat volume
  12016. \ PBRename
  12017. 17
  12018. FUNCTION PBRename (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  12019.  
  12020. Trap macro  _Rename
  12021.  
  12022. Parameter block
  12023.     —>  12  ioCompletion    pointer
  12024.     <—  16  ioResult        word
  12025.     —>  18  ioNamePtr       pointer
  12026.     —>  22  ioVRefNum       word
  12027.     —>  26  ioVersNum       byte
  12028.     —>  28  ioMisc          pointer
  12029.  
  12030.     Given a pointer to a file name in ioNamePtr (and on flat volumes, a
  12031. version number in ioVersNum), PBRename changes the name of the file to
  12032. the name pointed to by ioMisc. (If the name pointed to by ioNamePtr
  12033. contains one or more colons, so must the name pointed to by ioMisc.)
  12034. Access paths currently in use aren’t affected. Given a pointer to a
  12035. volume name in ioNamePtr or a volume reference number in ioVRefNum, it
  12036. changes the name of the volume to the name pointed to by ioMisc. If a
  12037. volume to be renamed is specified by its volume reference number,
  12038. ioNamePtr can be NIL.
  12039.  
  12040. Warning:  If a volume to be renamed is specified by its volume name, be
  12041.           sure that it ends with a colon, or Rename will consider it a
  12042.           file name.
  12043.  
  12044. Result codes    noErr       No error
  12045.                 bdNamErr    Bad file name
  12046.                 dirFulErr   File directory full
  12047.                 dupFNErr    Duplicate file name and version
  12048.                 extFSErr    External file system
  12049.                 fLckdErr    File locked
  12050.                 fnfErr      File not found
  12051.                 fsRnErr     Problem during rename
  12052.                 ioErr       I/O error
  12053.                 nsvErr      No such volume
  12054.                 paramErr    No default volume
  12055.                 vLckdErr    Software volume lock
  12056.                 wPrErr      Hardware volume lock
  12057. \ PBHRename
  12058. 17
  12059. FUNCTION PBHRename (paramBlock: HParmBlkPtr; async: BOOLEAN) : OSErr;
  12060.  
  12061. Trap macro  _HRename
  12062.  
  12063. Parameter block
  12064.     —>  12  ioCompletion    pointer
  12065.     <—  16  ioResult        word
  12066.     —>  18  ioNamePtr       pointer
  12067.     —>  22  ioVRefNum       word
  12068.     —>  28  ioMisc      pointer
  12069.     —>  48  ioDirID     long word
  12070.  
  12071.     PBHRename is identical to PBRename except that it accepts a
  12072. directory ID in ioDirID and can be used to rename directories as well as
  12073. files and volumes. Given a pointer to the name of a file or directory
  12074. in ioNamePtr, PBHRename changes it to the name pointed to by ioMisc.
  12075. Given a pointer to a volume name in ioNamePtr or a volume reference
  12076. number in ioVRefNum, it changes the name of the volume to the name
  12077. pointed to by ioMisc.
  12078.  
  12079. Warning:  PBHRename cannot be used to change the directory a file is in.
  12080.  
  12081. Result codes    noErr       No error
  12082.                 bdNamErr    Bad file name
  12083.                 dirFulErr   File directory full
  12084.                 dirNFErr    Directory not found or incomplete pathname
  12085.                 dupFNErr    Duplicate file name and version
  12086.                 extFSErr    External file system
  12087.                 fLckdErr    File locked
  12088.                 fnfErr      File not found
  12089.                 fsRnErr     Problem during rename
  12090.                 ioErr       I/O error
  12091.                 nsvErr      No such volume
  12092.                 paramErr    No default volume
  12093.                 vLckdErr    Software volume lock
  12094.                 wPrErr      Hardware volume lock
  12095. \ PBGetCatInfo
  12096. 17
  12097. FUNCTION PBGetCatInfo (paramBlock: CInfoPBPtr; async: BOOLEAN): OSErr;
  12098.  
  12099. Trap macro  _GetCatInfo
  12100.  
  12101. Parameter block
  12102.     Files:                              Directories:
  12103.     —>  12  ioCompletion    pointer —>  12  ioCompletion    pointer
  12104.     <—  16  ioResult        word    <—  16  ioResult        word
  12105.     <–> 18  ioNamePtr       pointer <–> 18  ioNamePtr       pointer
  12106.     —>  22  ioVRefNum       word    —>  22  ioVRefNum       word
  12107.     <—  24  ioFRefNum       word    <—  24  ioFRefNum       word
  12108.     —>  28  ioFDirIndex     word    —>  28  ioFDirIndex     word
  12109.     <—  30  ioFlAttrib      byte    <—  30  ioFlAttrib      byte
  12110.     <—  32  ioFlFndrInfo    16 bytes<—  32  ioDrUsrWds      16 bytes
  12111.     <–> 48  ioDirID         long    <–> 48  ioDrDirID       long
  12112.     <—  52  ioFlStBlk       word    <—  52  ioDrNmFls       word
  12113.     <—  54  ioFlLgLen       long
  12114.     <—  58  ioFlPyLen       long
  12115.     <—  62  ioFlRStBlk      word
  12116.     <—  64  ioFlRLgLen      long
  12117.     <—  68  ioFlRPyLen      long
  12118.     <—  72  ioFlCrDat       long    <—  72  ioDrCrDat       long
  12119.     <—  76  ioFlMdDat       long    <—  76  ioDrMdDat       long
  12120.     <—  80  ioFlBkDat       long    <—  80  ioDrBkDat       long
  12121.     <—  84  ioFlXFndrInfo   16 bytes<—  84  ioDrFndrInfo    16 bytes
  12122.     <—  100 ioFlParID       long    <—  100 ioDrParID       long
  12123.     <—  104 ioFlClpSiz      long
  12124.  
  12125.     PBGetCatInfo gets information about the files and directories in a
  12126. file catalog. To determine whether the information is for a file or a
  12127. directory, test bit 4 of ioFlAttrib, as described in the section
  12128. “CInfoPBRec”. The information that’s returned for files is shown in the
  12129. left column, and the corresponding information for directories is shown
  12130. in the right column.
  12131.  
  12132.     If ioFDirIndex is positive, the File Manager returns information
  12133. about the file or directory whose directory index is ioFDirIndex in the
  12134. directory specified by ioVRefNum (this will be the root directory if a
  12135. volume reference number is provided).
  12136.  
  12137.     If ioFDirIndex is 0, the File Manager returns information about the
  12138. file or directory specified by ioNamePtr, in the directory specified by
  12139. ioVRefNum (again, this will be the root directory if a volume reference
  12140. number is provided).
  12141.  
  12142.     If ioFDirIndex is negative, the File Manager ignores ioNamePtr and
  12143. returns information about the directory specified by ioDirID.
  12144.  
  12145.     With files, PBGetCatInfo is similar to PBHGetFileInfo but returns
  12146. some additional information. If the file is open, the reference number
  12147. of the first access path found is returned in ioFRefNum, and the name of
  12148. the file is returned in ioNamePtr (unless ioNamePtr is NIL).
  12149.  
  12150. Result codes    noErr       No error
  12151.                 bdNamErr    Bad file name
  12152.                 dirNFErr    Directory not found or incomplete pathname
  12153.                 extFSErr    External file system
  12154.                 fnfErr      File not found
  12155.                 ioErr       I/O error
  12156.                 nsvErr      No such volume
  12157.                 paramErr    No default volume
  12158. \ PBSetCatInfo
  12159. 17
  12160. FUNCTION PBSetCatInfo (paramBlock: CInfoPBPtr; async: BOOLEAN) : OSErr;
  12161.  
  12162. Trap macro  _SetCatInfo
  12163.  
  12164. Parameter block
  12165.     Files:                          Directories:
  12166.     —>  12  ioCompletion    pointer —>  12  ioCompletion    pointer
  12167.     <—  16  ioResult        word    <—  16  ioResult        word
  12168.     <–> 18  ioNamePtr       pointer <–> 18  ioNamePtr       pointer
  12169.     —>  22  ioVRefNum       word    —>  22  ioVRefNum       word
  12170.     —>  30  ioFlAttrib      byte    —>  30  ioFlAttrib      byte
  12171.     —>  32  ioFlFndrInfo    16 bytes—>  32  ioDrUsrWds      16 bytes
  12172.     —>  48  ioDirID         long    —>  48  ioDrDirID       long
  12173.     —>  72  ioFlCrDat       long    —>  72  ioDrCrDat       long
  12174.     —>  76  ioFlMdDat       long    —>  76  ioDrMdDat       long
  12175.     —>  80  ioFlBkDat       long    —>  80  ioDrBkDat       long
  12176.     —>  84  ioFlXFndrInfo   16 bytes—>  84  ioDrFndrInfo    16 bytes
  12177.     —>  104 ioFlClpSiz      long
  12178.  
  12179.     PBSetCatInfo sets information about the files and directories in a
  12180. catalog. With files, it’s similar to PBHSetFileInfo but lets you set
  12181. some additional information. The information that can be set for files
  12182. is shown in the left column, and the corresponding information for
  12183. directories is shown in the right column.
  12184.  
  12185. Result codes    noErr       No error
  12186.                 bdNamErr    Bad file name
  12187.                 dirNFErr    Directory not found or incomplete pathname
  12188.                 extFSErr    External file system
  12189.                 fnfErr      File not found
  12190.                 ioErr       I/O error
  12191.                 nsvErr      No such volume
  12192.                 paramErr    No default volume
  12193. \ PBCatMove
  12194. 17
  12195. FUNCTION PBCatMove (paramBlock: CMovePBPtr; async: BOOLEAN) : OSErr;
  12196.  
  12197. Trap macro  _CatMove
  12198.  
  12199. Parameter block
  12200.     —>  12  ioCompletion    pointer
  12201.     <—  16  ioResult        word
  12202.     —>  18  ioNamePtr       pointer
  12203.     —>  22  ioVRefNum       word
  12204.     —>  28  ioNewName       pointer
  12205.     —>  36  ioNewDirID      long word
  12206.     —>  48  ioDirID         long word
  12207.  
  12208.     PBCatMove moves files or directories from one directory to another.
  12209. The name of the file or directory to be moved is pointed to by
  12210. ioNamePtr; ioVRefNum contains either the volume reference number or
  12211. working directory reference number. A directory ID can be specified in
  12212. ioDirID. The name and directory ID of the directory to which the file
  12213. or directory is to be moved are specified by ioNewName and ioNewDirID.
  12214.  
  12215.     PBCatMove is strictly a file catalog operation; it does not actually
  12216. change the location of the file or directory on the disk. PBCatMove
  12217. cannot move a file or directory to another volume (that is, ioVRefNum is
  12218. used in specifying both the source and the destination). It also cannot
  12219. be used to rename files or directories; for that, use PBHRename.
  12220.  
  12221. Result codes    noErr       No error
  12222.                 badMovErr   Attempt to move into offspring
  12223.                 bdNamErr    Bad file name or attempt to move into a file
  12224.                 dupFNErr    Duplicate file name and version
  12225.                 fnfErr      File not found
  12226.                 ioErr       I/O error
  12227.                 nsvErr      No such volume
  12228.                 paramErr    No default volume
  12229.                 vLckdErr    Software volume lock
  12230.                 wPrErr      Hardware volume lock
  12231. \ PBOpenWD
  12232. 17
  12233. FUNCTION PBOpenWD (paramBlock: WDPBPtr; async: BOOLEAN) : OSErr;
  12234.  
  12235. Trap macro  _OpenWD
  12236.  
  12237. Parameter block
  12238.     —>  12  ioCompletion    pointer
  12239.     <—  16  ioResult        word
  12240.     —>  18  ioNamePtr       pointer
  12241.     <–> 22  ioVRefNum       word
  12242.     —>  28  ioWDProcID      long word
  12243.     —>  48  ioWDDirID       long word
  12244.  
  12245.     PBOpenWD takes the directory specified by ioVRefNum, ioWDDirID, and
  12246. ioWDProcID and makes it a working directory. (You can also specify the
  12247. directory using a combination of partial pathname and directory ID.)  It
  12248. returns a working directory reference number in ioVRefNum that can be
  12249. used in subsequent calls.
  12250.  
  12251.     If a given directory has already been made a working directory using
  12252. the same ioWDProcID, no new working directory will be opened; instead,
  12253. the existing working directory reference number will be returned. If a
  12254. given directory was already made a working directory using a different
  12255. ioWDProcID, a new working directory reference number is returned.
  12256.  
  12257. Result codes    noErr       No error
  12258.                 tmwdoErr    Too many working directories open
  12259. \ PBCloseWD
  12260. 17
  12261. FUNCTION PBCloseWD (paramBlock: WDPBPtr; async: BOOLEAN) : OSErr;
  12262.  
  12263. Trap macro  _CloseWD
  12264.  
  12265. Parameter block
  12266.     —>  12  ioCompletion    pointer
  12267.     <—  16  ioResult        word
  12268.     —>  22  ioVRefNum       word
  12269.  
  12270.     PBCloseWD releases the working directory whose working directory
  12271. reference number is specified in ioVRefNum.
  12272.  
  12273. Note:  If a volume reference number is specified in ioVRefNum, PBCloseWD
  12274.        does nothing.
  12275.  
  12276. Result codes    noErr   No error
  12277.                 nsvErr  No such volume
  12278. \ PBGetWDInfo
  12279. 17
  12280. FUNCTION PBGetWDInfo (paramBlock: WDPBPtr; async: BOOLEAN) : OSErr;
  12281.  
  12282. Trap macro  _GetWDInfo
  12283.  
  12284. Parameter block
  12285.     —>  12  ioCompletion    pointer
  12286.     <—  16  ioResult        word
  12287.     <—  18  ioNamePtr       pointer
  12288.     <–> 22  ioVRefNum       word
  12289.     —>  26  ioWDIndex       word
  12290.     <–> 28  ioWDProcID      long word
  12291.     <–> 32  ioWDVRefNum     word
  12292.     <—  48  ioWDDirID       long word
  12293.  
  12294.     PBGetWDInfo returns information about the specified working
  12295. directory. The working directory can be specified either by its working
  12296. directory reference number in ioVRefNum (in which case ioWDIndex should
  12297. be 0), or by its index number in ioWDIndex. In the latter case, if
  12298. ioVRefNum is nonzero, it’s interpreted as a volume specification (volume
  12299. reference number or drive number), and only working directories on that
  12300. volume are indexed.
  12301.  
  12302.     IOWDVRefNum always returns the volume reference number. IOVRefNum
  12303. returns a working directory reference number when a working directory
  12304. reference number is passed in that field; otherwise, it returns a volume
  12305. reference number. The volume name is returned in ioNamePtr.
  12306.  
  12307.     If IOWDProcID is nonzero, only working directories with that
  12308. identifier are indexed; otherwise all working directories are indexed.
  12309.  
  12310. Result codes    noErr   No error
  12311.                 nsvErr  No such volume
  12312. \ PrOpen
  12313. 18
  12314. PROCEDURE PrOpen;
  12315.  
  12316.     PrOpen prepares the Printing Manager for use. It opens the Printer
  12317. Driver and the printer resource file. If either of these items is
  12318. missing, or if the printer resource file is not properly formed, PrOpen
  12319. will do nothing, and PrError will return a Resource Manager result
  12320. code.
  12321. \ PrClose
  12322. 18
  12323. PROCEDURE PrClose;
  12324.  
  12325.     PrClose releases the memory used by the Printing Manager. It closes
  12326. the printer resource file, allowing the file's resource map to be
  12327. removed from memory. It *** currently *** doesn't close the Printer
  12328. Driver, however, since the driver may have been opened before the
  12329. PrOpen call was issued.
  12330. \ PrintDefault
  12331. 18
  12332. PROCEDURE PrintDefault (hPrint: THPrint);
  12333.  
  12334.     PrintDefault fills the fields of a print record with the current
  12335. default values stored in the printer resource file. HPrint is a handle
  12336. to the record, which may be a new print record that you've just
  12337. allocated or an existing one (from a document, for example).
  12338. \ PrValidate
  12339. 18
  12340. FUNCTION PrValidate (hPrint: THPrint) : BOOLEAN;
  12341.  
  12342.     PrValidate checks the contents of a print record for compatibility
  12343. with the current version of the Printing Manager and with the installed
  12344. printer. If the record is valid, the function returns FALSE (no
  12345. change); if invalid, the record is adjusted to the current default
  12346. values, taken from the printer resource file, and the function returns
  12347. TRUE.
  12348.  
  12349.     PrValidate also updates the print record to reflect the current
  12350. settings in the style and job subrecords. These changes have no effect
  12351. on the function's Boolean result.
  12352. \ PrStlDialog
  12353. 18
  12354. FUNCTION PrStlDialog (hPring: THPrint) : BOOLEAN;
  12355.  
  12356.     PrStlDialog conducts a style dialog with the user to determine the
  12357. paper size and paper orientation being used. The initial settings
  12358. displayed in the dialog box are taken from the current values in the
  12359. print record. If the user confirms the dialog, the results of the
  12360. dialog are saved in the print record and the function returns TRUE;
  12361. otherwise the print record is left unchanged and the function returns
  12362. FALSE.
  12363.  
  12364. (note)
  12365.     If the print record was taken from a document, you should
  12366.     update its contents in the document's file if PrStlDialog
  12367.     returns TRUE. This makes the results of the style dialog
  12368.     "stick" to the document.
  12369. \ PrJobDialog
  12370. 18
  12371. FULNCTION PrJobDialog (hPrint: THPrint) : BOOLEAN;
  12372.  
  12373.     PrJobDialog conducts a job dialog with the user to determine the
  12374. printing quality, number of pages to print, and so on. The initial
  12375. settings displayed in the dialog box are taken from the current values
  12376. in the print reord. If the user confirms the dialog, both the print
  12377. record and the printer resource file are updated (so that the user's
  12378. choices "stick" to the printer) and the function returns TRUE;
  12379. otherwise the print record and printer resource file are left unchanged
  12380. and the function returns FALSE.
  12381.  
  12382. (note)
  12383.     If the job dialog is associated with your application's
  12384.     Print command, you should proceed with the requested
  12385.     printing operation id PrJobDialog returns TRUE. If the
  12386.     print record was taken form a document, you should update
  12387.     its contents in the document's file.
  12388. \ PrJobMerge
  12389. 18
  12390. PROCEDURE PrJobMerge (hPringSrc,hPrintDst: THPrint):
  12391.  
  12392.     PrJobMerge copies the job subrecord from one print record
  12393. (hPrintSrc) to another (hPrintDst) and updates the destination record's
  12394. printer information, band information, and paper rectangle, based on
  12395. information in the job subrecord. This allows the information in the
  12396. job subrecord to be used for a group of related jobs.
  12397. \ PrOpenDoc
  12398. 18
  12399. FUNCTION PrOpenDoc (hPrint: THPrint; pPrPort: TPPrPort; pIOBuf: Ptr)
  12400.         : TPPrPort;
  12401.  
  12402.     PrOpenDoc initializes a printing port for use in printing a document
  12403. makes it the current port, and returns pointer to it. HPrint is a
  12404. handle to the print record for this printing operation. The printing
  12405. port is customized for draft printing or spooling, depending on the
  12406. setting of th bJDocLoop field in the job subrecord. For spooling, the
  12407. spool file's name, volume reference number, and version number are
  12408. taken from the job subrecord.
  12409.  
  12410.     PPrPort is a pointer to the storage to be used for the printing
  12411. port. If this parameter is NIL, PrOpenDoc will allocate a new printing
  12412. port for you. Similarly, pIOBuf points to an area of memory to be used
  12413. as an input/output buffer; if it's NIL, PrOpenDoc will use the volume
  12414. buffer for the spool file's volume.
  12415.  
  12416. (note)
  12417.     The pPrPort and pIOBuf parameters are provided because
  12418.     both the printing port and the input/output buffer are
  12419.     nonrelocatable objects. To avoid cluttering the heap
  12420.     with such objects, you have the opportunity to allocate
  12421.     them yourself and pass them to PrOpenDoc. Most of the
  12422.     time you'll just set both of these parameters to NIL.
  12423.  
  12424. (note)
  12425.     Newly created printing ports use the system font (since
  12426.     they're grafPorts), but newly created windows use the
  12427.     application font. Be sure the font you use in the
  12428.     printing port is the same as the font in your application
  12429.     window if yuou want the text in both places to match.
  12430. \ PrOpenPage
  12431. 18
  12432. PROCEDURE PrOpenPage (pPrPort: TPPrPort; pPageFrame: TPRect);
  12433.  
  12434.     PrOpenPage begins a new page in the document associated with the
  12435. given printing port. The page is printed only if it falls within the
  12436. page range designated in the job subrecord.
  12437.  
  12438.     For spooling, the pPageFrame parameter points to a rectangle that
  12439. will be used as the QuickDraw picture frame for this page:
  12440.  
  12441.     TYPE TPRect = ^Rect;
  12442.  
  12443.     When the spool file is later printed, this rectangle will be scaled
  12444. (via the QuickDraw DrawPicture procedure) to coincide with the page
  12445. rectangle in the printer ilnformation subrecord. Unless you want the
  12446. printout to be scaled, you should set pPageFrame to NIL--this uses the
  12447. curret page rectangle as the picture frame, and the page will be
  12448. printed with no scaling.
  12449. \ PrClosePage
  12450. 18
  12451. PROCEDURE PrClosePage (pPrPort: TPPrPort);
  12452.  
  12453.     PrClosePage finishes up the current page of the document associated
  12454. with the given printing port. For draft printing, it ejects the page
  12455. from the printer and, if necessary, alerts the user to insert another;
  12456. for spooling, it closes the picture representing the current page.
  12457. \ PrCloseDoc
  12458. 18
  12459. PROCEDURE PrCloseDoc (pPrPort: TPPrPort);
  12460.  
  12461.     PrCloseDoc finishes up the printing of the document associated with
  12462. the given printing port. For draft printing, it issues a form feed and
  12463. a reset command to the printer; for spooling, it closes the file if the
  12464. spooling was successfully completed or deletes it the file if the
  12465. spooling was unsuccessful.
  12466. \ PrPicFile
  12467. 18
  12468. PROCEDURE PrPicFile (hPrint: THPrint; pPrPort: TPPrPort; pIOBuf: Ptr;
  12469.         pDevBuf: Ptr; VAR prStatus: TPrStatus);
  12470.  
  12471.     PrPicFile images and prints a spool file. HPrint is a handle to the
  12472. print record for this printing operation. The name, volume reference
  12473. number, and version number of the spool file will be taken from the job
  12474. subrecord of this print record. After printing is successfully
  12475. completed, the Printing Manager deletes the spool file from the disk.
  12476.  
  12477.     PPrPort is a pointer to the storage to be used for the printing port
  12478. for this operation. If this parameter is NIL, PrPicFile will allocate
  12479. its own printing port. Similarly, pIOBuf points to an area of memory
  12480. to be used as an input/output buffer for reading the spool file; if
  12481. it's NIL, PrPicFile will use the volume buffer for the spool file's
  12482. volume. PDevBuf points to a similar buffer (the "band buffer") for
  12483. holding the bit image to be printed; ifNIL, PrPicFile will allocate
  12484. its own buffer from the heap. As for PrOpenDoc, you'll normally want
  12485. to set all of these storage parameters to NIL.
  12486.  
  12487. (note)
  12488.     If you provide your own storage for pDevBuf, it has to be
  12489.     big enough to hold the number of bytes indicated by the
  12490.     iDevBytes field of the TPrXInfo subrecord of the print
  12491.     record.
  12492.  
  12493. (warning)
  12494.     Be sure not to pass, in pPrPort, a pointer to the same
  12495.     printing port you received from PrOpenDoc, the one you
  12496.     originally used to spool the file. If that earlier port
  12497.     was allocated by PrOpenDoc itself (that is, if the
  12498.     pPrPort parameter to PrOpenDoc was NIL), then PrCloseDoc
  12499.     will have disposed of the port, making your pointer to it
  12500.     invalid. PrPicFile initializes a fresh printing port of
  12501.     its own; you just provide the storage (or let PrPicFIle
  12502.     allocate it for itself). Of course, if you earlier
  12503.     provided your own storage to PrOpenDoc, there's no reason
  12504.     you can't use the same storage again for PrPicFile.
  12505.  
  12506.     The prStatus parameter is a printer status record that PrPicFile
  12507. will use to report on its progress. Your background procedure (if any)
  12508. can use this record to monitor the state of the printing operation.
  12509. \ PrError
  12510. 18
  12511. FUNCTION PrError : INTEGER; [Pascal only]
  12512.  
  12513.     PrError returns the result code returned by the last Printing
  12514. Manager routine. The possible result codes are:
  12515.  
  12516.     CONST noErr       = 0;     {no error}
  12517.           iMemFullErr = -108;  {not enough heap space}
  12518.  
  12519.     and any Resource Manager result code. A result code of iMemFullErr
  12520. means that the Memory Manager was unable to fulfill a memory allocation
  12521. request by the Printing Manager.
  12522. \ PrSetError
  12523. 18
  12524. PROCEDURE PrSetError (iErr: INTEGER); [Pascal Only]
  12525.  
  12526.     PrSetError stores the specified value into the global variable where
  12527. the Printing Manager keeps its result code. The main *** (currently
  12528. the only) *** use of this procedure is for canceling a printing
  12529. operation in progress. To do this, write
  12530.  
  12531.     PrSetError(iPrAbort)
  12532.  
  12533. where iPrAbort is the following predefined constant:
  12534.  
  12535.     CONST iPrAbort = 128;  {result code for halting printing}
  12536. \ PrDrvrOpen
  12537. 18
  12538. PROCEDURE PrDrvrOpen;
  12539.  
  12540.     PrDrvrOpen opens the Printer Driver.
  12541. \ PrDrvrClose
  12542. 18
  12543. PROCEDURE PrDrvrClose;
  12544.  
  12545.     PrDrvrClose closes the Printer Driver.
  12546. \ PrCtlCall
  12547. 18
  12548. PROCEDURE PrCtlCall (iWhichCtl: INTEGER; lParam1,lParam2,lParam3):
  12549.                     LongInt);
  12550.  
  12551.     PrCtlCall calls the Printer Driver's control routine. IWhichCtl
  12552. designates the operation to be performed; the rest of the parameters
  12553. depend on the operation.
  12554. \ PrDrvrDCE
  12555. 18
  12556. FUNCTION PrDrvrDCE : Handle;
  12557.  
  12558.     PrDrvrDCE returns a handle to the Printer Driver's device control
  12559. entry.
  12560. \ PrDrvrVers
  12561. 18
  12562. FUNCTION PrDrvrVers : INTEGER;
  12563.  
  12564.     PrDrvrVers returns the version number of the Printer Driver in the
  12565. system resource file.
  12566.  
  12567.     The version number of the Printing Manager is available as the
  12568. predefined constant iPrRelease. You may want to compare the result of
  12569. PrDrvrVers with iPrRelease to see if the Printer Driver in the resource
  12570. file is the most recent version.
  12571. \ PrNoPurge
  12572. 18
  12573. PROCEDURE PrNoPurge;
  12574.  
  12575.     PrNoPurge prevents the Printer Driver from being purged from the
  12576. heap.
  12577. \ PrPurge
  12578. 18
  12579. PROCEDURE PrPurge;
  12580.  
  12581.     PrPurge allows the Printer Driver to be purged from the heap.
  12582. \ OpenDriver
  12583. 19
  12584. FUNCTION OpenDriver (name: Str255; VAR refNum: INTEGER) : OSErr;
  12585.  
  12586.     OpenDriver opens the device driver specified by name and returns its
  12587. reference number in refNum.
  12588.  
  12589.     Result codes    noErr           No error
  12590.                     badUnitErr      Bad reference number
  12591.                     dInstErr        Couldn't find driver in resource
  12592.                                     file
  12593.                     openErr         Driver cannot perform the
  12594.                                     requested reading or writing
  12595.                     unitEmptyErr    Bad reference number
  12596. \ CloseDriver
  12597. 19
  12598. FUNCTION CloseDriver (refNum: INTEGER) : OSErr;
  12599.  
  12600.     CloseDriver closes the device driver having the reference number
  12601. refNum. Any pending I/O is completed, and the memory used by the
  12602. driver is released.
  12603.  
  12604.  
  12605.     Result codes    noErr           No error
  12606.                     badUnitErr      Bad reference number
  12607.                     dRemoveErr      Tried to remove an open driver
  12608.                     unitEmptyErr    Bad reference number
  12609. \ FSRead
  12610. 19
  12611. FUNCTION FSRead (refNum: INTEGER; VARcount: LongInt; buffPtr: Ptr) :
  12612.         OSErr;
  12613.  
  12614.     FSRead attempts to read the number of bytes specified by the count
  12615. parameter from the device driver having the reference number refNum,
  12616. and transfer them to the data buffer pointed to by buffPtr. After the
  12617. read operation is completed, the number of bytes actually read is
  12618. returned in the count parameter.
  12619.  
  12620.  
  12621.     Result codes    noErr           No error
  12622.                     badUnitErr      Bad reference number
  12623.                     notOpenErr      Driver isn't open
  12624.                     unitEmptyErr    Bad reference number
  12625.                     readErr         Driver can't respond to Read
  12626.                                     calls
  12627. \ FSWrite
  12628. 19
  12629. FUNCTION FSWrite (refNum: INTEGR; VARcount: LongInt; buffPtr: Ptr) :
  12630.                     OSErr;
  12631.  
  12632.     FSWrite attempts to take the number of bytes specified by the count
  12633. parameter from the buffer pointed to by buffPtr and write them to the
  12634. open device driver having the reference number refNum. After the write
  12635. operation is completed, the number of bytes actually written is
  12636. returned in the count parameter.
  12637.  
  12638.     Result codes    noErr           No error
  12639.                     badUnitErr      Bad reference number
  12640.                     notOpenErr      Driver isn't open
  12641.                     unitEmptyErr    Bad reference number
  12642.                     writErr         Driver can't respond to Write
  12643.                                     calls
  12644. \ Control
  12645. 19
  12646. FUNCTION COntrol (refNum: INTEGER; csCode: INTEGER; csParam: Ptr):
  12647.         OSErr;
  12648.  
  12649.     Control sends control information to the device driver haaving the
  12650. reference number refNum. The type of information sent is specified by
  12651. csCode, and the ilnformation itself is pointed to by csParam. The
  12652. values passed in csCode and pointed to by csParam depend on the driver
  12653. being called.
  12654.  
  12655.  
  12656.     Result codes    noErr           No error
  12657.                     badUnitErr      Bad reference number
  12658.                     notOpenErr      Driver isn't open
  12659.                     unitEmptyErr    Bad reference number
  12660.                     controlErr      Driver can't respond to this
  12661.                                     Control call
  12662.  
  12663.  
  12664.  
  12665. \ Status
  12666. 19
  12667. FUNCTION Status (refNum: INTEGER; csCode: INTEGER; csParam: Ptr) :
  12668.         OSErr;
  12669.  
  12670.     Status returns status information about the device driver having the
  12671. reference number refNum. The type of information returned is specified
  12672. by csCode, and the information itself is pointed to by csParam. The
  12673. values passed in csCode and pointed to by csParam depend on the driver
  12674. being called.
  12675.  
  12676.     Result codes    noErr           No error
  12677.                     badUnitErr      Bad reference number
  12678.                     notOpenErr      Driver isn't open
  12679.                     unitEmptyErr    Bad reference number
  12680.                     statusErr       Driver can't respond to this
  12681.                                     Status call
  12682. \ KillIO
  12683. 19
  12684. FUNCTION KillIO (refNum: INTEGER) : OSErr;
  12685.  
  12686.     KillIO terminates all current and pending I/O with the device driver
  12687. having the reference number refNum.
  12688.  
  12689.     Result codes    noErr           No error
  12690.                     badUnitErr      Bad reference number
  12691.                     unitEmptyErr    Bad reference number
  12692.                     controlErr      Driver can't respond to KillIO
  12693.                                     calls
  12694.  
  12695. (note)
  12696.     KillIO is actually a special type of PBControl call, and
  12697.     all information aabout PBControl calls applies equally to
  12698.     KillIO.
  12699. \ PBOpen
  12700. 19
  12701. FUNCTION PBOpen (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  12702.  
  12703.     Trap macro  _Open
  12704.  
  12705.     Parameter block
  12706.         --> 12  ioCompletion    pointer
  12707.         <-- 16  ioResult    word
  12708.         --> 18  ioNamePtr   pointer
  12709.         <-- 24  ioRefNum    word
  12710.         --> 27  ioPermssn   byte
  12711.  
  12712.     Result codes    noErr           No error
  12713.                     badUnitErr      Bad reference number
  12714.                     dInstErr        Couldn't find driver in resource
  12715.                                     file
  12716.                     openErr         Driver cannot perform the
  12717.                                     requested reading or writing
  12718.                     unitEmptyErr    Bad reference number
  12719.  
  12720.  
  12721.     PBOpen opens the device driver specified by ioNamePtr and returns
  12722. its reference number in ioRefNum. IOPermssn specifies the requested
  12723. read/write permission.
  12724. \ PBClose
  12725. 19
  12726. FUNCTION PBCLose (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  12727.  
  12728.     Trap macro  _Close
  12729.  
  12730.     Parameter block
  12731.         --> 12  ioCompletion    pointer
  12732.         <-- 16  ioResult    word
  12733.         --> 24  ioRefNum    word
  12734.  
  12735.     Result codes    noErr           No error
  12736.                     badUnitErr      Bad reference number
  12737.                     dRemoveErr      Tried to remove an open driver
  12738.                     unitEmptyErr    Bad reference number
  12739.  
  12740.  
  12741.     PBClose closes the device driver having the reference number
  12742. ioRefNum. Any pending I/O is completed, and the memory used by the
  12743. driver is released.
  12744. \ PBRead
  12745. 19
  12746. FUNCTION PBRead (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  12747.  
  12748.     Trap macro  _Read
  12749.  
  12750.     Parameter block
  12751.         --> 12  ioCompletion    pointer
  12752.         <-- 16  ioResult    word
  12753.         --> 24  ioRefNum    word
  12754.         --> 32  ioBuffer    pointer
  12755.         --> 36  ioReqCount  long word
  12756.         <-- 40  ioActCount  long word
  12757.         --> 44  ioPosMode   word
  12758.         <-> 46  ioPosOffset long word
  12759.  
  12760.  
  12761.  
  12762.  
  12763.     Result codes    noErr           No error
  12764.                     badUnitErr      Bad reference number
  12765.                     notOpenErr      Driver isn't open
  12766.                     unitEmptyErr    Bad reference number
  12767.                     readErr         Driver can't respond to Read
  12768.                                     calls
  12769.  
  12770.     PBRead attempts to read ioReqCount bytes from the device driver
  12771. having the reference number ioRefNum, and transfer them to the data
  12772. buffer pointed to by ioBuffer. After the read operation is completed,
  12773. the number of bytes actually read is returned in ioActCount.
  12774.  
  12775. Advanced programmers:  If the driver is reading from a block device,
  12776.                        the byte offset from the position indicated by
  12777.                        ioPosMode, where the read should actually betwin,
  12778.                        is given by ioPosOffset.
  12779. \ PBWrite
  12780. 19
  12781. FUNCTION PBWrite (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  12782.  
  12783.     Trap macro  _Write
  12784.  
  12785.     Parameter block
  12786.         --> 12  ioCompletion    pointer
  12787.         <-- 16  ioResult    word
  12788.         --> 24  ioRefNum    word
  12789.         --> 32  ioBuffer    pointer
  12790.         --> 36  ioReqCount  long word
  12791.         <-- 40  ioActCount  long word
  12792.         --> 44  ioPosMode   word
  12793.         --> 46  ioPosOffset long word
  12794.  
  12795.     Result codes    noErr       No error
  12796.             badUnitErr  Bad reference number
  12797.             notOpenErr  Driver isn't open
  12798.             unitEmptyErr    Bad reference number
  12799.             writErr Driver  can't respond to Write
  12800.                     calls
  12801.  
  12802.     PBWrite attempts to take ioReqCount bytes from the buffer pointed to
  12803. by ioBuffer and write them to the device driver having the reference
  12804. number ioRefNum. After the write operation is completed, the number of
  12805. bytes actually written is returned in ioActCount.
  12806.  
  12807. Advanced programmers:  If the driver is writing to a block device,
  12808.                        ioPosMode indicates whether the write should
  12809.                        begin relative to the beginning of the device or
  12810.                        the current position. The byte offset from the
  12811.                        position indicated by ioPosMode, where the write
  12812.                        should actually begin, is given by ioPosOffset.
  12813. \ PBControl
  12814. 19
  12815. FUNCTION PBControl (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  12816.  
  12817.     Trap macro  _Control
  12818.  
  12819.     Parameter block
  12820.         --> 12  ioCompletion    pointer
  12821.         <-- 16  ioResult    word
  12822.         --> 24  ioRefNum    word
  12823.         --> 26  csCode      word
  12824.         --> 28  csParam     record
  12825.  
  12826.     Result codes    noErr           No error
  12827.                     badUnitErr      Bad reference number
  12828.                     notOpenErr      Driver isn't open
  12829.                     unitEmptyErr    Bad reference number
  12830.                     controlErr      Driver can't respond to this
  12831.                                     Control call
  12832.  
  12833.  
  12834.     PBControl sends control information to the device driver having the
  12835. reference number ioRefNum. The type of information sent is specified
  12836. by csCode, and the information itself begins at csParam. The values
  12837. passed in csCode and csParam depend on the driver being called.
  12838. \ PBStatus
  12839. 19
  12840. FUNCTION PBStatus (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  12841.  
  12842.     Trap macro  _Status
  12843.  
  12844.     Parameter block
  12845.         --> 12  ioCompletion    pointer
  12846.         <-- 16  ioResult    word
  12847.         --> 24  ioRefNum    word
  12848.         --> 26  csCode      word
  12849.         --> 28  csParam     record
  12850.  
  12851.     Result codes    noErr       No error
  12852.             badUnitErr  Bad reference number
  12853.             notOpenErr  Driver isn't open
  12854.             unitEmptyErr    Bad reference number
  12855.             statusErr   Driver can't respond to this
  12856.                     Status call
  12857.  
  12858.     PBStatus returns status information about the device driver having
  12859. the reference number ioRefNum. The type of information returned is
  12860. specified by csCode, and the information itself begins at csParam. The
  12861. values passed in csCode and csParam depend on the driver being called.
  12862. \ PBKillIO
  12863. 19
  12864. FUNCTION PBKillIO (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  12865.  
  12866.     Trap macro  _KillIO
  12867.  
  12868.     Parameter block
  12869.         --> 12  ioCompletion    pointer
  12870.         <-- 16  ioResult    word
  12871.         --> 24  ioRefNum    word
  12872.  
  12873.     Result codes    noErr       No error
  12874.             badUnitErr  Bad reference number
  12875.             unitEmptyErr    Bad reference number
  12876.             controlErr  Driver can't respond to KillIO
  12877.                     calls
  12878.  
  12879.     KillIO stops any current I/O request being processed, and removes
  12880. all pending I/O requests from the I/O queue of the device driver having
  12881. the reference number ioRefNum. The completion routine of each pending
  12882. I/O request is called, with ioResult equal to the following result code:
  12883.  
  12884.     CONST abortErr = -27;
  12885.  
  12886. (note)
  12887.     KillIO is actually a special type of Control call, and
  12888.     all information about Control calls applies equally to
  12889.     KillIO.
  12890. \ DiskEject
  12891. 20
  12892. FUNCTION DiskEject (drvNum: INTEGER) : OSErr;
  12893.  
  12894.     __________________________________________________________________
  12895.  
  12896.     Assembly-language note: DiskEject is equivalent to a Control
  12897.     call with csCode equivalent to the global constant ejectCode.
  12898.     __________________________________________________________________
  12899.  
  12900.     DiskEject ejects the disk from the internal drive if drvNum is 1, or
  12901. from the external drive if drvNum is 2.
  12902.  
  12903.     Result codes
  12904.  
  12905.             noErr       No error
  12906.             nsDrvErr    No such drive
  12907. \ SetTagBuffer
  12908. 20
  12909. FUNCTION SetTagBuffer (buffPtr: Ptr) : OSErr;
  12910.  
  12911.     __________________________________________________________________
  12912.  
  12913.     Assembly-language note:  SetTagBuffer is equivalent to a Control
  12914.     call with csCode = 8.
  12915.     __________________________________________________________________
  12916.  
  12917.     An application can change the information used in the file tags
  12918. buffer by calling SetTagBuffer. The buffPtr parameter points to a
  12919. buffer that contains the information to be used. If buffPtr is NIL, the
  12920. information in the file tags buffer isn't changed.
  12921.  
  12922.     If buffPtr isn't NIL, every time the Disk Driver reads a sector from
  12923. the disk, it stores the file tags in the file tags buffer
  12924. by calling SetTagBuffer. The buffPtr parameter points to a buffer that
  12925. contains the information to be used. If buffPtr is NIL, the
  12926. information in the file tags buffer isn't changed.
  12927.  
  12928.     The contents of the buffer pointed to by buffPtr are overwritten at
  12929. the end of every read request (which can be composed of a number of
  12930. sectors) instead of at the end of every sector. Each read request
  12931. places 12 bytes in the buffer for each sector, always beginning at the
  12932. start of the buffer. This way an application can examine the file tags
  12933. for a number of sequentially read sectors. If a read request is
  12934. composed of a number of sectors, the Disk Driver reads 12 bytes from
  12935. the buffer for each sector. For example, for a read request of five
  12936. sectors, the Disk Driver will read 60 bytes from the buffer.
  12937.  
  12938.     __________________________________________________________________
  12939.  
  12940.     Assembly-language note:  An assembly-language program can change
  12941.     the information used in the file tags buffer by storing a
  12942.     pointer to the buffer containing the information in the global
  12943.     variable TagBufPtr. If TagBufPtr is 0, the information in the
  12944.     file tags buffer isn't changed.
  12945.     __________________________________________________________________
  12946.  
  12947.     Result codes
  12948.  
  12949.             noErr       No error
  12950. \ DriveStatus
  12951. 20
  12952. FUNCTION DriveStatus (drvNum: INTEGER; VAR status: DrvSts) : OSErr;
  12953.  
  12954.     _________________________________________________________________
  12955.  
  12956.     Assembly-language note:  DriveStatus is equivalent to a Status
  12957.     call with csCode equivalent to teh globval constant drvStsCode.
  12958.     _________________________________________________________________
  12959.  
  12960.     DriveStatus returns information about the internal drive if drvNum
  12961. is 1, or about the external drive if drvNum is 2. The information is
  12962. returned in a record of type DrvSts:
  12963.  
  12964. TYPE DrvSts = RECORD
  12965.         track:      INTEGER;     {current track}
  12966.         writeProt:  SignedByte;  {bit 7=1 if volume is locked}
  12967.         diskInPlace:    SignedByte;  {disk in place}
  12968.         installed:  SignedByte;  {drive installed}
  12969.         sides:      SignedByte;  {bit 7=0 if single-sided drive}
  12970.         qLink:      QElmPtr;     {next queue entry}
  12971.         qType:      INTEGER;     {not used}
  12972.         dqDrive:    INTEGER;     {drive number}
  12973.         dqRefNum:   INTEGER;     {driver reference number}
  12974.         dqFSID:     INTEGER;     {file-system identifier}
  12975.         twoSideFmt: SignedByte;  {-1 if two-sided disk}
  12976.         needsFlush: SignedByte;  {reserved}
  12977.         diskErr:    INTEGER;     {error count}
  12978.       END;
  12979.  
  12980.     The diskInPlace field is 0 if there's no disk in the drive, 1 or 2
  12981. if there is a disk in the drive, or -4 to -1 if the disk was ejected in
  12982. the last 1.5 seconds. The installed field is 1 if the drive might be
  12983. connected to the Macintosh, and -1 if the drive isn't installed. 
  12984. The value oftwoSideFmt is valid only when diskInPlace = 2. The value
  12985. of diskErrs is incremented every time an error occurs internally within
  12986. the Disk Driver.
  12987.  
  12988.     Result codes
  12989.  
  12990.             noErr       No error
  12991.             nsDrvErr    No such drive
  12992. \ StartSound
  12993. 21
  12994. PROCEDURE StartSound (synthRec: Ptr; numBytes: LONGINT; completionRtn:
  12995.         ProcPtr);
  12996.  
  12997.     StartSound begins producing the sound(s) described by the
  12998. synthesizer buffer pointed to by synthRec. NumBytes indicates the
  12999. length of the synthesizer buffer (in bytes), and completionRtn points to
  13000. a completion routine to be executed when the sound finishes:
  13001.  
  13002.     - If completionRtn is POINTER(-1), the sound will be produced
  13003.       synchronously.
  13004.  
  13005.     - If completionRtn is NIL, the sound will be produced
  13006.       asynchronously, but no completion routine will be executed.
  13007.  
  13008.     - Otherwise, the sound will be produced asynchronously and the
  13009.       routine pointed to by completionRtn will be executed when the
  13010.       sound finishes.
  13011.  
  13012. (warning)
  13013.     You may want the completion routine to start the next
  13014.     sound when one sound finishes, but beware:  Completion
  13015.     routines are executed at the interrupt level, and
  13016.     shouldn't make any calls to the Memory Manager. Be sure
  13017.     to preallocate all the space you'll need. Or, instead of
  13018.     using a completion routine to start the next sound, the
  13019.     completion routine can post an application-defined event
  13020.     and your application's main event lop can start the next
  13021.     sound when it gets the event.
  13022.  
  13023.     Because the type of pointer for each type of synthesizer buffer is
  13024. different and the type of the synthRec parameter is Ptr, you'll need to
  13025. do something like the following example (which applies to the free-form
  13026. synthesizer):
  13027.  
  13028.     VAR myPtr: Ptr;
  13029.         myHandle: Handle;
  13030.         myFFPtr: FFSynthPtr;
  13031.         ...
  13032.     myHandle := NewHandle(buffSize);     {allocate space for the buffer}
  13033.     HLock(myHandle);             {lock the buffer}
  13034.     myPtr := myHandle^;          {dereference the handle}
  13035.     myFFPtr := FFSynthPtr(myPtr);        {coerce type to FFSynthPtr}
  13036.     myFFPtr^.mode := ffMode;         {identify the synthesizer}
  13037.     ...                  {fill the buffer with values}
  13038.                          {describing the sound}
  13039.     StartSound(myPtr,buffSize,POINTER(-1));    {produce the sound}
  13040.     HUnlock(myHandle)              {unlock the buffer}
  13041.  
  13042. where buffSize is the length of the synthesizer record.
  13043.  
  13044. The sounds are generated as follows:
  13045.  
  13046.     - Free-form synthesizer:  The magnitudes described by each byte in
  13047.       the waveform description are genereated sequentially until the
  13048.       number of bytes specified by the numBytes paramaeter have been
  13049.       written.
  13050.  
  13051.     - Square-wave synthesizer:  The sounds described by each sound
  13052.       triplet are generaed sequentially until either the end of the
  13053.       buffer has been reached (indicated by a count, amplitude, and
  13054.       duration of 0 in the square-wave buffer), or the number of bytes
  13055.       specified by the numBytes parameter have been written.
  13056.  
  13057.     - Four-tone synthesizer:  All four sounds are generated for the
  13058.       length of time specified by the duration integer in the four-tone
  13059.       record.
  13060. \ StopSound
  13061. 21
  13062. PROCEDURE StopSound;
  13063.  
  13064.     StopSound immediately stops the current StartSound call (if any),
  13065. executes the current StartSound call's completion routine (if any), and
  13066. cancels any pending asynchrounous StartSound calls.
  13067. \ SoundDone
  13068. 21
  13069. FUNCTION SoundDone : BOOLEAN;
  13070.  
  13071.     SoundDone returns TRUE if the Sound Driver isn't currently producing
  13072. sound and there are no asynchronous StartSound calls pending; otherwise
  13073. it returns FALSE.
  13074. \ GetSoundVol
  13075. 21
  13076. PROCEDURE GetSoundVol (VAR level: INTEGER);
  13077.  
  13078.     GetSoundVol returns the current speaker volume, from 0 (silence) to
  13079. 7 (loudest).
  13080.  
  13081.     __________________________________________________________________
  13082.  
  13083.     Assembly-language note:  To set the speaker volume level from
  13084.     assembly language, call this Pascal routine from your program.
  13085.     As a side effect, it will set the low-order three bits of the
  13086.     global variable SdVolume to the specified level.
  13087.     __________________________________________________________________
  13088.  
  13089. (note)
  13090.     Your program shouldn't change the speaker volume unless
  13091.     it's a Control Panel-like desk accessory, since it's
  13092.     really up to the user to choose the desired volume level
  13093.     via the Control Panel.
  13094. \ RAMSDOpen
  13095. 22
  13096. FUNCTION RAMSDOpen (whichPort: SPortSel; rsrcType: OSType; rsrcID:
  13097.         INTEGER) : OSErr;
  13098.  
  13099.     RAMSDOpen closes the ROM Serial Driver and opens the RAM input and
  13100. output drivers for the port identified by the whichPort parameter,
  13101. which must be a member of the SPortSel set:
  13102.  
  13103.     TYPE SPortSel = (sPortA, {modem port}
  13104.              sPortB  {printer port});
  13105.  
  13106.     RsrcType and rsrcID indicate the resource type and resource ID of
  13107. the RAM Serial Driver, which should be stored in your application's
  13108. resource file. (OSType is an Operating System Utility data type
  13109. declared the same as ResType in the Resource Manager.)
  13110.  
  13111.     Result codes
  13112.  
  13113.             noErr       No error
  13114.             openErr     Can't open driver
  13115. \ RAMSDClose
  13116. 22
  13117. PROCEDURE RAMSDClose (whichPort: SPortSel);
  13118.  
  13119.     RAMSDClose closes the RAM input and output drivers for the port
  13120. identified by the whichPort parameter, which must be a member of the
  13121. SPortSel set (defined int eh description of RAMSDOpen above).
  13122. \ SerReset
  13123. 22
  13124. FUNCTION SerReset (refNum: INTEGER; serConfig: INTEGER) : OSErr;
  13125.  
  13126.     SerReset resets and reinitializeds the input or output driver having
  13127. the reference number refNum according to the information in serConfig.
  13128. Figure 3 shows the format of serConfig.
  13129.  
  13130.     You can use the following predefined constants to set the values of
  13131. various bits of serConfig:
  13132.  
  13133. CONST   baud300     = 380;      {300 baud}
  13134.         baud600     = 189;      {600 baud}
  13135.         baud1200    = 94;       {1200 baud}
  13136.         baud1800    = 62;       {1800 baud}
  13137.         baud2400    = 46;       {2400 baud}
  13138.         baud3600    = 30;       {3600 baud}
  13139.         baud4800    = 22;       {4800 baud}
  13140.         baud7200    = 14;       {7200 baud}
  13141.         baud9600    = 10;       {9600 baud}
  13142.         baud19200   = 4;        {19200 baud}
  13143.         baud57600   = 0;        {57600 baud}
  13144.         stop10      = 16384;    {1 stop bit}
  13145.         stop15      = -32768;   {1.5 stop bits}
  13146.         stop20      = -16384;   {2 stop bits}
  13147.         noParity    = 8192;     {no parity}
  13148.         oddParity   = 4096;     {odd parity}
  13149.         evenParity  = 12288;    {even parity}
  13150.         data5       = 0;        {5 data bits}
  13151.         data6       = 2048;     {6 data bits}
  13152.         data7       = 1024;     {7 data bits}
  13153.         data8       = 3072;     {8 data bits}
  13154.  
  13155.  
  13156.     For example, the default setting of 9600 baud, eight data bits, two
  13157. stop bits, and no parity bit is equivalent to baud9600+data8+stop20+
  13158. noParity.
  13159. \ SerSetBuf
  13160. 22
  13161. FUNCTION SerSetBuf (refNum: INTEGER; serBPtr: Ptr; serBLen: INTEGER) :
  13162.         OSErr;
  13163.  
  13164.     SerSetBuf specifies a new input buffer for the input driver having
  13165. the reference number refNum. SerBPtr points to the buffer, and serBLen
  13166. specifies the number of bytes in the buffer. If serBLen is 0, a
  13167. 64-byte default buffer provided by the driver is used.
  13168.  
  13169. (warning)
  13170.     You must lock this buffer while it's in use.
  13171.  
  13172.     __________________________________________________________________
  13173.  
  13174.     Assembly-language note: SerSetBuf is equivalent to a Control
  13175.     call with csCode=9, csParam=serBPtr, and csParam+2=serBLen.
  13176.     __________________________________________________________________
  13177.  
  13178.     Result codes    noErr       No error
  13179. \ SerHShake
  13180. 22
  13181. FUNCTION SerHShake (refNum: INTEGER; flags: SerShk) : OSErr;
  13182.  
  13183.     SerHShake sets handshake options and other control information, as
  13184. specified by the flags parameter, for the input or output driver having
  13185. the reference number refNum. The flags parameter has the following
  13186. data structure:
  13187.  
  13188.     TYPE SerShk = PACKED RECORD
  13189.             fXOn: Byte; {XOn/XOff output flow control flag}
  13190.             fCTS: Byte;     {CTS hardware handshake flag}
  13191.             xOn:  CHAR; {XOn character}
  13192.             xOff: CHAR; {XOff character}
  13193.             errs: Byte; {errors that cause abort}
  13194.             evts: Byte; {status changes that cause events}
  13195.             fInX: Byte; {XOn/XOff input flow control flag}
  13196.             null: Byte  {not used}
  13197.                END;
  13198.  
  13199.     If fXOn is nonzero, XOn/XOff output flow control is enabled; if fInX
  13200. is nonzero, XOn/XOff input flow control is enabled. XOn and xOff specify
  13201. the XOn character and XOff character used for XOn/XOff flow control.
  13202. If fCTS is nonzero, CTS hardware handshake is enabled. The errs field
  13203. indicates which errors will cause input requests to be aborted; for
  13204. each type of error, there's  a predefined constant in which the 
  13205. corresponding bit is set:
  13206.  
  13207.     CONST parityErr     = 16;   {set for parity error}
  13208.           hwOverrunErr  = 32;   {set for hardware overrun error}
  13209.           framingErr    = 64;   {set for framing error}
  13210.  
  13211. (note)
  13212.     The ROM Serial Driver doesn't support XOn/XOff input flow
  13213.     control or aborts caused by error conditions.
  13214.  
  13215.     The evts field indicates whether changes in the CTS or break status
  13216. will cause the Serial Driver to post device driver events; you can use
  13217. the following predefined constants to set or test the value of evts:
  13218.  
  13219.     CONST ctsEvent   = 32;  {set if CTS change will cause event to}
  13220.                 {be posted}
  13221.           breakEvent = 128; {set if break status change will cause}
  13222.                     {event to be posted}
  13223.  
  13224.  
  13225. (warning)
  13226.     Use of this option is discouraged because of the long
  13227.     time that interrupts are disabled while such an event is
  13228.     posted.
  13229.  
  13230.     ___________________________________________________________________
  13231.  
  13232.     Assembly-language note:  SerHShake is equivalent to a Control
  13233.     call with csCode=10 and csParam through csParam+6 equivalent to
  13234.     the fields of a variable of type SerShk.
  13235.     ___________________________________________________________________
  13236.  
  13237.     Result codes    noErr       No error
  13238. \ SerSetBrk
  13239. 22
  13240. FUNCTION SerSetBrk (refNum: INTEGER) : OSErr;
  13241.  
  13242. SerSetBrk sets break mode in the input or output driver having the
  13243. reference number refNum.
  13244.  
  13245.     ___________________________________________________________________
  13246.  
  13247.     Assembly-language note:  SerSetBrk is equivalent to a Control
  13248.     call with csCode=12.
  13249.     ___________________________________________________________________
  13250.  
  13251.     Result codes
  13252.  
  13253.             noErr       No error
  13254. \ SerClrBrk
  13255. 22
  13256. FUNCTION SerClrBrk (refNumk: INTEGER) : OSErr;
  13257.  
  13258.     SerClrBrk clears break mode in the inplut or output driver having
  13259. the reference number refNum.
  13260.  
  13261.     __________________________________________________________________
  13262.  
  13263.     Assembly-language note:  SerClrBrk is equivalent to a Control
  13264.     call with csCode=11.
  13265.     __________________________________________________________________
  13266.  
  13267.     Result codes
  13268.  
  13269.         noErr       No error
  13270. \ SerGetBuf
  13271. 22
  13272. FUNCTION SerGetBuf (refNum: INTEGER; VAR count: LONGILNT) ; OSErr;
  13273.  
  13274.     SerGetBuf returns, in the count parameter, the number of bytes in
  13275. the buffer of the input driver having the reference number refNum.
  13276.  
  13277.     ____________________________________________________________________
  13278.  
  13279.     Assembly-language note:  SerGetBuf is equivalent to a Status
  13280.     call with csCode=2. The number of bytes in the buffer is
  13281.     returned in csParam.
  13282.     ____________________________________________________________________
  13283.  
  13284.     Result codes
  13285.  
  13286.         noErr       No error
  13287. \ SerErrFlag
  13288. 22
  13289. FUNCTION SerErrFlag (refNum: INTEGER; VAR serSta: SerStaRec) : OSErr;
  13290.  
  13291.     SerErrFlag returns in serSta three words of status information for
  13292. the input or output driver having the reference number refNum. The
  13293. serSta parameter has the following data structure:
  13294.  
  13295.     TYPE SerStaRec = PACKED RECORD
  13296.                cumErrs:   Byte; {cumulative errors}
  13297.                xOffSent:  Byte; {XOff sent as input flow}
  13298.                         { control}
  13299.                rdPend:    Byte; {read pending flag}
  13300.                wrPend:    Byte;     {write pending flag}
  13301.                ctsHold:   Byte; {CTS flow control hold flag}
  13302.                xOffHold:  Byte; {XOff received as output}
  13303.                             { flow control}
  13304.              END;
  13305.  
  13306.     CumErrs indicates which errors have occurred since the last time
  13307. SerErrFlag was called:
  13308.  
  13309.        CONST swOverrunErr = 1;  {set for software overrun error}
  13310.          parityErr    = 16; {set for parity error}
  13311.          hwOverrunErr = 32; {set for hardware overrun error}
  13312.          framingErr   = 64; {set for framing error}
  13313.  
  13314.  
  13315.     If the driver has sent an XOff character, xOffSent will be equal to
  13316. the following predefined constant:
  13317.  
  13318.     CONST xOffWasSent = $80;    {XOff character was sent}
  13319.  
  13320.     If the driver has a Read or Write call pending, rdPend or wrPend,
  13321. respectively, will be nonzero. If output has been suspended because
  13322. the hardware handshake was negated, ctsHold will be nonzero. If output
  13323. has been suspended because an XOff character was received, xOffHold
  13324. will be nonzero.
  13325.  
  13326.     __________________________________________________________________
  13327.  
  13328.     Assembly-language note:  SerStatus is equivalent to a Status
  13329.     call with csCode=8. The status information is returned in
  13330.     csParam through csParam+5.
  13331.     __________________________________________________________________
  13332.  
  13333.     Result codes    noErr       No error
  13334. \ MPPOpen
  13335. 23
  13336. FUNCTION MPPOpen : OSErr;  [Not in ROM]
  13337.  
  13338. MPPOpen first checks whether the .MPP driver is already loaded; if it
  13339. is, MPPOpen does nothing and returns noErr. If MPP hasn't been loaded,
  13340. MPPOpen attempts to load it into the system heap. If it succeeds, it
  13341. then initializes the driver's variables and goes through the process of
  13342. dynamically assigning a node ID to that Macintosh. On a Macintosh 512K
  13343. or XL, it also loads the .ATP driver and NBP code into the system heap.
  13344.  
  13345. If serial port B isn't configured for AppleTalk, or is already in use,
  13346. the .MPP driver isn't loaded and an appropriate result code is
  13347. returned.
  13348.  
  13349.     Result codes    noErr       No error
  13350.             portInUse   Port B is already in use
  13351.             portNotCf   Port B not configured for AppleTalk
  13352.  
  13353.  
  13354.  
  13355.  
  13356. \ MPPClose
  13357. 23
  13358. FUNCTION MPPClose : OSErr;   [Not in ROM]
  13359.  
  13360. MPPClose removes the .MPP driver, and any data structures associated
  13361. with it, from memory. If the .ATP driver or NBP code were also
  13362. installed, they'll also be removed. MPPClose also returns the use of
  13363. port B to the Serial Driver.
  13364.  
  13365. (warning)
  13366.     Since other co-resident programs may be using AppleTalk,
  13367.     it's strongly recommended that you never use this call. 
  13368.     MPPClose will completely disabale AppleTalk; the only way
  13369.     to restore ApleTalk is to call MPPOpen again.
  13370.  
  13371.  
  13372.  
  13373.  
  13374. \ LAPOpenProtocol
  13375. 23
  13376. FUNCTION LAPOpenProtocol (theLAPType: ABBYte; protoPtr: Ptr) : OSErr;
  13377.         [Not in ROM]
  13378.  
  13379. LAPOpenProtocol adds the LAP protocol type specified by theLAPType to
  13380. the node's protocol table. If you provide a pointer to a protocol 
  13381. handler in protoPtr, ALAP will send each frame with a LAP protocol type
  13382. of theLAPType to that protocol handler.
  13383.  
  13384. If protoPtr is NIL, the default protocol handler will be used for
  13385. receiving frames with a LAP protocol type of theLAPType. In this case,
  13386. to receive a frame you must acall LAPRead to provide the default
  13387. protocol handler with a buffer for placing the data. If, however,
  13388. you've written your own protocol handler and protoPtr points to it,
  13389. your protocol handler will have the responsibility fro receiving the
  13390. frame and it's not necessary to call LAPRead.
  13391.  
  13392.     Result codes    noErr       No error
  13393.             lapProtErr  Error attaching protocol type
  13394.  
  13395.  
  13396.  
  13397.  
  13398. \ LAPWrite
  13399. 23
  13400. FUNCTION LAPWrite (abRecord: ABRecHandle; async: BOOLEAN) : OSErr;
  13401.         [Not in ROM]
  13402.  
  13403.     ABusRecord
  13404.     ----------
  13405.        <--    abOpcode          {always tLAPWrite}
  13406.        <--    abResult          {result code}
  13407.        -->    abUserReference       {for your use}
  13408.        -->    lapAddress.dstNodeID      {destination node ID}
  13409.        -->    lapAddress.lapProtType    {LAP protocol type}
  13410.        -->    lapReqCount           {length of frame data}
  13411.        -->    lapDataPtr            {pointer to frame data}
  13412.  
  13413. LAPWrite sends a frame to another node. LAPReqCount and lapDataPtr
  13414. specify the length and location of the data to send. The
  13415. lapAddress.lapProtType field indicates the node ID of the node to
  13416. which the frame should be sent.
  13417.  
  13418. (note)
  13419.     The first two bytes of an ALAP frame's data must contain
  13420.     the length in bytes of the data, including the length
  13421.     bytes themselves.
  13422.  
  13423.     Result codes    noErr       No error
  13424.             excessCollsns   Unable to contact destination
  13425.                     node; packet not sent
  13426.  
  13427.  
  13428.  
  13429.  
  13430. \ LAPRead
  13431. 23
  13432. FUNCTION LAPRead (abRecord: ABRecHandle; async: BOOLEAN) : OSErr;
  13433.         [Not in ROM]
  13434.  
  13435.     ABusRecord
  13436.     ----------
  13437.        <--    abOpcode      {always tLAPWrite}
  13438.        <--    abResult      {result code}
  13439.        -->    abUserReference   {for your use}
  13440.        <--    lapAddress.dstNodeID  {packet's destination node ID}
  13441.        <--    lapAddress.srcNodeID  {packet's source node ID}
  13442.        -->    lapAddress.lapProtType{LAP protocol type}
  13443.        -->    lapReqCount       {buffer size in bytes}
  13444.        <--    lapActCount       {number of frame data bytes actually }
  13445.                     {received}
  13446.        -->    lapDataPtr        {pointer to buffer}
  13447.  
  13448.  
  13449. LAPRead receives a frame from another node. LAPReqCount and lapDataPtr
  13450. specify the length and location of the buffer that will receive the
  13451. frame data. If the buffer isn't large enough to hold all of the
  13452. incoming frame data, the extra bytes wil be discarded and buf2SmallErr
  13453. will be returned. The number of bytes actually received is returned in
  13454. lapActCount. Only frames with LAP protocol type equal to
  13455. lapAddress.lapProtType will be received. The node number of the
  13456. frame's source and destination nodes are returned in
  13457. lapAddress.srcNodeID and lapAddress.dstNodeID respectively. You can
  13458. determine if the packet was broadcast to you by examining the value of
  13459. lapAddress.dstNodeID--if the packet was broadcast it's equal to 255,
  13460. otherwise it's equal to your node ID.
  13461.  
  13462. (note)
  13463.     You should issue LAPRead calls only for LAP protocol
  13464.     types that were opened (via LAPOpenProtocol) to use the
  13465.     default protocol handler.
  13466.  
  13467.     Result codes    noErr       No error
  13468.             buf2SmallErr    Frame too large for buffer
  13469.             readQErr    Invalid protocol type or
  13470.                     protocol type not found in table
  13471.  
  13472.  
  13473.  
  13474.  
  13475. \ LAPRdCancel
  13476. 23
  13477. FUNCTION LAPRdCancel (abRecord: ABRecHandle) : OSErr;  [Not in ROM]
  13478.  
  13479. Given the handle to the ABusRecord of a previously made LAPRead call,
  13480. LAPRdCancel dequeues the LAPRead call, provided that a packet
  13481. satisfying the LAPRead has not already arrived. LAPRdCancel returns
  13482. noErr if the LAPRead call is successfully removed fdrom the queue. If
  13483. LAPRdCancel returns recNotFnd, check the abResult field to verify that
  13484. the LAPRead has been completed and determine its outcome.
  13485.  
  13486.     Result codes    noErr       No error
  13487.             readQErr    Invalid protocol type or
  13488.                     protocol type not found in table
  13489.             recNotFnd   ABRecord n ot found in queue
  13490.  
  13491.  
  13492.  
  13493.  
  13494. \ DDPOpenSocket
  13495. 23
  13496. FUNCTION DDPOpenSocket (VAR theSocket: Byte; sktListener: Ptr) : OSErr;
  13497.         [Not in ROM]
  13498.  
  13499. DDPOpenSocket adds a socket and its socket listener to the socket
  13500. table. If theSocket is nonzero (it must be in the range of 64 to 127),
  13501. it specifies the socket's number. If theSocket is 0, DDPOpenSocket
  13502. dynamically assigns a socket number in the range 128 to 254, and
  13503. returns it in theSocket. SktListener contains a pointer to the socket
  13504. listener; if it'e NIL, the default listener will be used.
  13505.  
  13506. If you're using the default socket listener, you must then call DDPRead
  13507. to receive a datagram (in order to specify buffer space for the default
  13508. socket listener). If, however, you've written your own socket listener
  13509. and sktListener points to it, your listener will provide buffers for
  13510. receiving datagrams and you shouldn't use DDPRead calls.
  13511.  
  13512. DDPOpenSocket will return ddpSktErr if you pass the number of an
  13513. already opened socket, if you pass a socket number greater than 127, or
  13514. if the socket table is full.
  13515.  
  13516. (note)
  13517.     The range of static socket numbers 1 through 63 is
  13518.     reserved for use by AppleTalk. Socket numbers 64 through
  13519.     127 are available for unrestricted experimental use.
  13520.  
  13521.     Result codes    noErr       No error
  13522.             ddpSktErr   Socket error
  13523.  
  13524.  
  13525.  
  13526.  
  13527. \ DDPCloseSocket
  13528. 23
  13529. FUNCTION DDPCloseSocket (theSocket: Byte) : OSErr;   [Not in ROM]
  13530.  
  13531. DDPCloseSocket removes the entry of the specified socket from the
  13532. socket table and cancels all pending DDPRead calls that have been made
  13533. to close a socket that isn't open, DDPCloseSocket will return
  13534. ddpSktErr.
  13535.  
  13536.     Result codes    noErr       No error
  13537.             ddpSktErr   Socket error
  13538.  
  13539.  
  13540.  
  13541. \ DDPWrite
  13542. 23
  13543. FUNCTION DDPWrite (abRecord: ABRecfHandle; doChecksum: BOOLEAN; async:
  13544.         BOOLEAN) : OSErr;   [Not in ROM]
  13545.  
  13546.     ABusRecord
  13547.     ----------
  13548.        <--    abOpcode      {always tDDPWrite}
  13549.        <--    abResult      {result code}
  13550.        -->    abUserReference   {for your use}
  13551.        -->    ddpType       {DDP protocol type}
  13552.        -->    ddpSocket         {source socket number}
  13553.        -->    ddpAddress        {destination socket address}
  13554.        -->    ddpReqCount       {length of datagram data}
  13555.        -->    ddpDataPtr        {pointer to buffer}
  13556.  
  13557. DDPWrite sends a datagram to another socket. DDPReqCount and
  13558. ddpDataPtr specify the length and location of the data to send. The
  13559. ddpType field indicates the DDP protocol type of the frame, and
  13560. ddpAddress is the complete internet address of the socket to which the
  13561. datagram should be sent. DDPSocket specifies the socket from which the
  13562. datagram should be sent. Datagrams sent over the internet to a node on
  13563. an AppleTalk network different from the sending node's network have an
  13564. optional software checksum to detect errors that might occur inside the
  13565. intermediate bridges. If doChecksum is TRUE, DDPWrite will compute
  13566. this checksum; if it's FALSE, this software checksum feature is
  13567. ignored.
  13568.  
  13569. (note)
  13570.     The destination socket can't be in the same node as the
  13571.     program making the DDPWrite call.
  13572.  
  13573.     Result codes    noErr       No error
  13574.             ddpLenErr   Datagram length too big
  13575.             ddpSktErr   Source socket not open
  13576.  
  13577.  
  13578.  
  13579. \ DDPRead
  13580. 23
  13581. FUNCTION DPRead (abRecord: ABRecfHandle; retChecksum: BOOLEAN; async:
  13582.         BOOLEAN) : OSErr;   [Not in ROM]
  13583.  
  13584.     ABusRecord
  13585.     ----------
  13586.        <--    abOpcode      {always tDDPWrite}
  13587.        <--    abResult      {result code}
  13588.        -->    abUserReference   {for your use}
  13589.        <--    ddpType       {DDP protocol type}
  13590.        -->    ddpSocket         {listening socket number}
  13591.        <--    ddpAddress        {source socket address}
  13592.        -->    ddpReqCount       {buffer size in bytes}
  13593.        <--    ddpActCount       {number of bytes actually received}
  13594.        -->    ddpDataPtr        {pointer to buffer}
  13595.        <--    ddpNodeID     {original destination node ID}
  13596.  
  13597.  
  13598. DDPRead receives a datagram from another socket. The length and
  13599. location of the buffer that will receive the data are specified by
  13600. ddpReqCount and ddpDataPtr, respectively. If the buffer isn't large
  13601. enough to hold all of the incoming frame data, the extra bytes will be
  13602. discarded and buf2SmallErr will be returned. The numbr of bytes
  13603. actually received is returned in ddpActCount. DDPSocket specifies the
  13604. socket to receive the datagram (the "listening" socket). The node to
  13605. which the packet was sent is returned in ddpNodeID; if the packet was
  13606. broadcast ddpNodeID will contain 255. The address of the socket that
  13607. sent the packet is returned in ddpAddress. If retCksumErrs is FALSE,
  13608. DDPRead will discard any packets received with an invalid checksum and
  13609. inform the caller of the error. If retCksumErr is TRUE, DDPRead will
  13610. deliver all packets, regardless of whether the checksum is valid or
  13611. not; it will also notify the caller when there's a checksum error.
  13612.  
  13613. (note)
  13614.     The sender of the datagram must be in a different node
  13615.     from the receiver. Youk should issue DDPRead calls only
  13616.     for receiving datagrams for sockets opened with the
  13617.     default socket listener; see the description of
  13618.     DDPOpenSocket.
  13619.  
  13620. (note)
  13621.     If DDPRead returns buf2SmallErr, it will deliver packets
  13622.     even if retCksukmErrs is FALSE.
  13623.  
  13624.     Result codes    noErr       No error
  13625.             buf2SmallErr    Datagram too large for buffer
  13626.             cksumErr    Checksum error
  13627.             ddpLenErr   Datagram length too big
  13628.             ddpSktErr   Socket error
  13629.             readQErr    Invalid socket or
  13630.                     socket not found in table
  13631.  
  13632.  
  13633.  
  13634. \ DDPRdCancel
  13635. 23
  13636. FUNCTION DDPRdCancel (abRecord: ABRecHandle) : OSErr;   [Not in ROM]
  13637.  
  13638. Given the handle to the ABusRecord of a previously made DDPRead call,
  13639. DDPRdCancel dequeues the DDPRead call, provided that a packet
  13640. satisfying the DDPRead hasn't already arrived. DDPRdCancel returns
  13641. noErr if the DDPRead call is successfully removed from the queue. If
  13642. DDPRdCancel returns recNotFnd, check the abResult field of abRecord to
  13643. verify that the DDPRead has been completed and determine its outcome.
  13644.  
  13645.  
  13646.     Result codes    noErr       No error
  13647.             readQErr    Invalid socket or
  13648.                     socket not found in table
  13649.             recNotFnd   ABRecord not found in queue
  13650.  
  13651.  
  13652.  
  13653. \ ATPLoad
  13654. 23
  13655. FUNCTION ATPLoad : OSErr;   [Not in ROM]
  13656.  
  13657. ATPLoad first verifies that the .MPP driver is loaded and running. If
  13658. it isn't, ATPLoad verifies that port B is configured for AppleTalk, and
  13659. is not in use, and then loads MPP into the system heap.
  13660.  
  13661. ATPLoad then loads the .ATP driver, unless it's already in memory. On
  13662. a Macintosh 128K, ATPLoad reads the .ATP driver from the system
  13663. resource file into the application heap; on a Macintosh 512K or XL, ATP
  13664. is read into the system heap.
  13665.  
  13666. (note)
  13667.     On a Macintosh 512K or XL, ATPLoad and MPPOpen perform
  13668.     essentially the same function.
  13669.  
  13670.  
  13671.  
  13672.     Result codes    noErr       No error
  13673.             portInUse   Port B is already in use
  13674.             portNotCf   Port B not configured for AppleTalk
  13675.  
  13676.  
  13677.  
  13678.  
  13679.  
  13680. \ ATPUnload
  13681. 23
  13682. FUNCTION ATPUnload : OSErr;   [Not in ROM]
  13683.  
  13684. ATPUnload makes the .ATP driver purgeable; the space isn't actually
  13685. released by the Memory Manager until necessary.
  13686.  
  13687. (note)
  13688.     This call applies only to a Macintosh 128K; on a
  13689.     Macintosh 512K or Macintosh XL, ATPUnload has no effect.
  13690.  
  13691.     Result codes    noErr       No error
  13692.  
  13693.  
  13694.  
  13695. \ ATPOpenSocket
  13696. 23
  13697. FUNCTION ATPOpenSocket (addrRcvd: AddrBlock; VAR atpSocket: Byte) :
  13698.         OSErr;   [Not in ROM]
  13699.  
  13700. ATPOpenSocket opens a socket for the purpose of receiving requests.
  13701. ATPSocket contains the socket number of the socket to open; if it's 0,
  13702. a number is dynamically assigned and returned in atpSocket. AddrRcvd
  13703. contains a filter of the sockets from which requests will be accepted.
  13704. A 0 in the network number, node ID, or socket number field of the
  13705. addrRcvd record acts as a "wild card"; for instance, a 0 in the socket
  13706. number field means that requests will be accepted from all sockets in
  13707. the node(s) specified by the network and node fields.
  13708.  
  13709.     Result codes    noErr       No error
  13710.             tooManySkts Socket table ful
  13711.             noDataArea  Too many outstanding ATP calls
  13712.  
  13713. (note)
  13714.     If you're only going to send requests and receive
  13715.     responses to these requests, you don't need to open an
  13716.     ATP socket. When you make the ATPSndRequest or
  13717.     ATPRequest call, ATP automatically opens a dynamically
  13718.     assigned socket for that purpose.
  13719.  
  13720.  
  13721.  
  13722. \ ATPCloseSocket
  13723. 23
  13724. FUNCTION ATPCLoseSocket (atpSocket: Byte) : OSErr;   [Not in ROM]
  13725.  
  13726. ATPCloseSocket closes the responding socket whose number is specified
  13727. by atpSocket. It releases the data structures associated with all
  13728. pending, asynchronous calls involving that socket; these pending calls
  13729. are completed immediately and return the result code sktClosed.
  13730.  
  13731.     Result codes    noErr       No error
  13732.             noDataArea  Too many outstanding ATP calls
  13733.  
  13734.  
  13735.  
  13736. \ ATPSndRequest
  13737. 23
  13738. FUNCTION ATPSndRequest (abRecord: ABRecHandle; async: BOOLEAN) : OSErr;
  13739.         [Not in ROM]
  13740.  
  13741.     ABusRecord
  13742.     ----------
  13743.        <--  abOpcode    {always tATPSndRequest}
  13744.        <--  abResult    {result code}
  13745.        -->  abUserReference {for your use}
  13746.        -->  atpAddress  {destination socket address}
  13747.        -->  atpReqCount {request size in bytes}
  13748.        -->  atpDataPtr  {pointer to buffer}
  13749.        -->  atpRspBDSPtr    {pointer to response BDS}
  13750.        -->  atpUserData {user bytes}
  13751.        -->  atpXO       {exactly-once flag}
  13752.        <--  atpEOM      {end-of-message flag}
  13753.        -->  atpTimeOut  {retry timeout interval in seconds}
  13754.        -->  atpRetries  {maximum number of retries}
  13755.        -->  atpNumBufs  {number of elements in response BDS}
  13756.        <--  atpNumRsp   {number of response packets actually }
  13757.                 {received}
  13758.  
  13759. ATPSndRequest sends a request to another socket. ATPAddress is the
  13760. internet address of the socket to which the request should be sent.
  13761. ATPDataPtr and atpReqCount specify the location and size of a buffer
  13762. that contains the request information to be sent. ATPUserData contains
  13763. the user bytes for the ATP header.
  13764.  
  13765. ATPSndRequest requires you to allocate a response BDS. ATPRspBDSPtr is
  13766. a pointer to the response BDS; atpNumBufs indicates the number of BDS
  13767. elements in the BDS (this is also the maximum number of response
  13768. datagrams that will be accepted). The number of response datagrams
  13769. actually received is returned in atpNumRsp; if a nonzero value is
  13770. returned, you can examine the response BDS to determine which packet
  13771. of the transaction were actually received. If the number returned is
  13772. less than requested, one of the folowing is true:
  13773.  
  13774.     - Some of the packets have been lost and the retry count has been
  13775.       exceeded.
  13776.  
  13777.     - ATPEOM is TRUE; this means that the response consisted of fewer
  13778.       packets than were expected, but that all packets sent were
  13779.       received (the last packet came with the atpEOM flag set).
  13780.  
  13781. ATPTimeOut indicates the length of time that ATPSndRequest should wait
  13782. for a response before retransmitting the request. ATPRetries indicates
  13783. the maximum number of retries ATPSndRequest shoud attempt. ATPXO
  13784. should be TRUE if you want the request to be part of an exactly-once
  13785. transaction.
  13786.  
  13787. ATPSndRequest completes when either the transaction is completed or the
  13788. retry count is exceeded.
  13789.  
  13790.     Result codes    noErr       No error
  13791.             reqFailed   Retry count exceeded
  13792.             tooManyReqs Too many concurrent requests
  13793.             noDataArea  Too many outstanding ATP calls
  13794.  
  13795.  
  13796.  
  13797. \ ATPRequest
  13798. 23
  13799. FUNCTION ATPRequest (abRecord: ABRecHandle; async: BOOLEAN) : OSErr;
  13800.         [Not in ROM]
  13801.  
  13802.     ABusRecord
  13803.     ----------
  13804.        <--  abOpcode    {always tATPRequest}
  13805.        <--  abResult    {result code}
  13806.        -->  abUserReference {for your use}
  13807.        -->  atpAddress  {destination socket address}
  13808.        -->  atpReqCount {request size in bytes}
  13809.        -->  atpDataPtr  {pointer to buffer}
  13810.        <--  atpActCount {number of bytes actually received}
  13811.        -->  atpUserData {user bytes}
  13812.        -->  atpXO       {exactly-once flag}
  13813.        <--  atpEOM      {end-of-message flag}
  13814.        -->  atpTimeOut  {retry timeout interval in seconds}
  13815.        -->  atpRetries  {maximum number of retries}
  13816.        <--  atpRspUData {user bytes received in transaction}
  13817.                 { response}
  13818.        -->  atpRspBuf   {pointer to response message buffer}
  13819.        -->  atpRspSize  {size of response message buffer}
  13820.  
  13821. ATPRequest is functionally analogous to ATPSndRequest. It sends a
  13822. request to another socket, but doesn't require the caller to set up and
  13823. use the BDS data structure to describe the response buffers.
  13824. ATPAddress indicates the socket to which the request should be sent.
  13825. ATPDataPtr and atpReqCount specify the location and size of a buffer
  13826. that contains the request information to be sent. ATPUserData contains
  13827. the uset bytes to be sent in the request's ATP header. ATPTimeOut
  13828. indicates the length of time that ATPRequest should wait for a response
  13829. before retransmitting the request. ATPRetries indicates the maximum
  13830. number of retries ATPRequest should attempt.
  13831.  
  13832. To use this call, you must have an area of contiguous buffer space
  13833. that's large enough to receive all expected datagrams. The various
  13834. datagrams will be assembled in this buffer and returned to you as a
  13835. complete message upon completion of the transaction. The address and
  13836. size of this buffer are pased in atpRspBuf and atpRspSize,
  13837. respectively. Upon completion of the call, the size ofthe received
  13838. response message is returned in atpActCount. The user bytes received
  13839. in the ATP header of the first response packet are returned in
  13840. atpRspUData. ATPXO should be TRUE if you want the request to be part
  13841. of an exactly-once transaction.
  13842.  
  13843. Although you don't provide a BDS, ATPRequest in fact creates one and
  13844. calls the .ATP driver (as in an ATPSndRequest call). For this reason,
  13845. the abRecord fields atpRspBDSPtr and atpNumBufs are used by ATPRequest;
  13846. you should not expect these fields to remain unaltered during or after
  13847. the function's execution.
  13848.  
  13849. For ATPRequest to receive and correctly deliver the response as a
  13850. single message, the responding end must, upon receiving the request
  13851. (with an ATPGetRequest call), generate the complete response as a
  13852. complete message in a single buffer and then call ATPResponse.
  13853.  
  13854. (note)
  13855.     The responding end could also use ATPSndRsp and ATPAddRsp
  13856.     provided that each response packet (except the last one)
  13857.     contains exactly 578 ATP data bytes; the last packet in
  13858.     the response can contain less than 578 ATP data bytes.
  13859.     Also, if this method is used, only the ATP user bytes of
  13860.     the first response packet will be delivered to the
  13861.     requester; any information in the user bytes of the
  13862.     remaining response packets will not be delivered.
  13863.  
  13864. ATPRequest completes when either the transaction is completed or the
  13865. retry count is exceeded.
  13866.  
  13867.     Result codes    noErr       No error
  13868.             reqFailed   Retry count exceeded
  13869.             tooManyReqs Too many concurrent requests
  13870.             sktClosed   Socket closed by a cancel call
  13871.             noDataArea  Too many outstanding ATP calls
  13872.  
  13873.  
  13874.  
  13875.  
  13876. \ ATPReqCancel
  13877. 23
  13878. FUNCTION ATPReqCancel (abRecord: ABRecHandle; async: BOOLEAN) : OSErr;
  13879.         [Not in ROM]
  13880.  
  13881. Given the handle to the ABusRecord of a previously made ATPSndRequest
  13882. or ATPRequest call, ATPReqCancel dequeues the ATPSndRequest or
  13883. ATPRequest call, provided that the call hasn't already completed.
  13884. ATPReqCancel returns noErr if the ATPSndRequest or ATPRequest call is
  13885. successfully removed from the queue. If it returns cbNotFound, check
  13886. the abResult field of abRecord to verify that the ATPSndRequest or
  13887. ATPRequest call has been completed and determine its outcome.
  13888.  
  13889.     Result codes    noErr       No error
  13890.             cbNotFound  ATP control block not found
  13891.  
  13892.  
  13893.  
  13894.  
  13895. \ ATPGetRequest
  13896. 23
  13897. FUNCTION ATPGetRequest (abRecord: ABRecHandle; async: BOOLEAN) :
  13898.         OSErr;   [Not in ROM]
  13899.  
  13900.     ABusRecord
  13901.     ----------
  13902.        <--  abOpcode    {always tATPGetRequest}
  13903.        <--  abResult    {result code}
  13904.        -->  abUserReference {for your use}
  13905.        -->  atpSocket   {listening socket number}
  13906.        <--  atpAddress  {source socket address}
  13907.        -->  atpReqCount {buffer size in bytes}
  13908.        -->  atpDataPtr  {pointer to buffer}
  13909.        <--  atpBitMap   {transaction bit map}
  13910.        <--  atpTransID  {transaction ID}
  13911.        <--  atpActCount {number of bytes actually received}
  13912.        <--  atpUserData {user bytes}
  13913.        <--  atpXO       {exactly-once flag}
  13914.  
  13915. ATPGetRequest sets up the mechanism to receive a request sent by either
  13916. an ATPSndRequest or an ATPRequest call. ATPSocket contains the socket
  13917. number of the socket that should listen for a request; this socket must
  13918. already have been opened by calling ATPOpenSocket. The address of the
  13919. socket from which the request was sent is returned in atpAddress.
  13920. ATPDataPtr specifies a buffer to store the incoming request;
  13921. atpReqCount indicates the size of the buffer in bytes. The number of
  13922. bytes actually received in the request is returned in atpActCount.
  13923. ATPUserData contains the user bytes from the ATP header. The
  13924. transaction bit map is returned in atpBitMap. The transaction ID is
  13925. returned in atpTransID. ATPXO will be TRUE if the request is part of
  13926. an exactly-once transaction.
  13927.  
  13928. ATPGetRequest completes when a request is received. To cancel an
  13929. asynchronous ATPGetRequest call, you must call ATPCloseSocket, but this
  13930. cancels all pending calls involving that socket.
  13931.  
  13932.  
  13933.     Result codes    noErr       No error
  13934.             badATPSkt   Bad responding socket
  13935.                 sktClosed   Socket closed by a cancel call
  13936.  
  13937.  
  13938.  
  13939.  
  13940. \ ATPSndRsp
  13941. 23
  13942. FUNCTION ATPSndRsp (abRecord: ABRecHandle; async: BOOLEAN) :
  13943.         OSErr;   [Not in ROM]
  13944.  
  13945.  
  13946.     ABusRecord
  13947.     ----------
  13948.        <--  abOpcode    {always tATPSndRsp}
  13949.        <--  abResult    {result code}
  13950.        -->  abUserReference {for your use}
  13951.        -->  atpSocket   {responding socket number}
  13952.        -->  atpAddress  {destination socket address}
  13953.        -->  atpRspBDSPtr    {pointer to response BDS}
  13954.        -->  atpTransID  {transaction ID}
  13955.        -->  atpEOM      {end-of-message flag}
  13956.        -->  atpNumBufs  {number of response packets being }
  13957.                 {sent}
  13958.        -->  atpBDSSize  {number of elements in response BDS}
  13959.  
  13960.  
  13961. ATPSndRsp sends a response to another socket. ATPSocket contains the
  13962. socket number from which the response should be sent and atpAddress
  13963. contains the internet address of the socket to which the response
  13964. should be sent. ATPTransID must contain the transaction ID. ATPEOM is
  13965. TRUE if the response BDS contains the final packet in a transaction
  13966. composed of a group of packets and the number of packets in the
  13967. response is less than expected. ATPRspBDSPtr points to the buffer data
  13968. structure containing the responses to be sent. ATPBDSSize indicates
  13969. the number of elements in the response BDS, and must be in the range 1
  13970. to 8. ATPNumBufs indicates the number of response packets being sent
  13971. with this call, and must be in the range 0 to 8.
  13972.  
  13973. (note)
  13974.     In some situations, you may want to send only part (or
  13975.     possibly none) of your response message back immediately.
  13976.     For instance, you might be requested to send back seven
  13977.     disk blocks, but have only enough internal memory to
  13978.     store one block. In this case, set atpBDSSize to 7
  13979.     (total number of response packets), atpNumBufs to 0
  13980.     (number of response packets currently being sent), and
  13981.     call ATPSndRsp. Then as you read in one block at a time,
  13982.     call ATPAddRsp until all seven response datagrams have
  13983.     been sent.
  13984.  
  13985. During exactly-once transactions, ATPSndRsp won't complete until the
  13986. release packet is received or the release timer expires.
  13987.  
  13988.  
  13989.     Result codes    noErr       No error
  13990.             badATPSkt   Bad responding socket
  13991.             noRelErr    No release received
  13992.                 sktClosed   Socket closed by a cancel call
  13993.             noDataArea  Too many outstanding ATP calls
  13994.  
  13995.  
  13996.  
  13997. \ ATPAddRsp
  13998. 23
  13999. FUNCTION ATPAddRsp (abRecord: ABRecHandle) : OSErr;   [Not in ROM]
  14000.  
  14001.  
  14002.     ABusRecord
  14003.     ----------
  14004.        <--  abOpcode    {always tATPAddRsp}
  14005.        <--  abResult    {result code}
  14006.        -->  abUserReference {for your use}
  14007.        -->  atpSocket   {responding socket number}
  14008.        -->  atpAddress  {destination socket address}
  14009.        -->  atpReqCount {buffer size in bytes}
  14010.        -->  atpDataPtr  {pointer to buffer}
  14011.        -->  atpTransID  {transaction ID}
  14012.        -->  atpUserData {user bytes}
  14013.        -->  atpEOM      {end-of-message flag}
  14014.        -->  atpNumRsp   {sequence number}
  14015.  
  14016. ATPAddRsp sends one additional response packet to a socket that has
  14017. already been sent the initial part of a response via ATPSndRsp.
  14018. ATPSocket contains the socket number from which the response should be
  14019. sent and atpAddress contains the internet address of the socket to
  14020. which the response should be sent. ATPTransID must contain the
  14021. transaction ID. ATPDataPtr and atpReqCount specify the location and
  14022. size of a buffer that contains the information to send; atpNumRsp is
  14023. the sequence number of the response. ATPEOM is TRUE if this repsonse
  14024. datagram is the final packet in a transaction composed of a group of
  14025. packets. ATPUserData contains the user bytes to be sent in this
  14026. response datagram's ATP header.
  14027.  
  14028. (note)
  14029.     No BDS is needed with ATPAddRsp because all pertinent
  14030.     information is passed within the record.
  14031.  
  14032.  
  14033.     Result codes    noErr       No error
  14034.             badATPSkt   Bad responding socket
  14035.             badBuffNum  Bad sequence number
  14036.             noSendResp  ATPAddRsp issued before ATPSndRsp
  14037.             noDataArea  Too many outstanding ATP calls
  14038.  
  14039.  
  14040.  
  14041.  
  14042. \ ATPResponse
  14043. 23
  14044. FUNCTION ATPResponse (abRecord: ABRecHandle; async: BOOLEAN) :
  14045.         OSErr;   [Not in ROM]
  14046.  
  14047.  
  14048.     ABusRecord
  14049.     ----------
  14050.        <--  abOpcode    {always tATPResponse}
  14051.        <--  abResult    {result code}
  14052.        -->  abUserReference {for your use}
  14053.        -->  aptSocket   {responding socket number}
  14054.        -->  atpAddress  {destination socket address}
  14055.        -->  atpRspUData {user bytes sent in transaction}
  14056.                 { response}
  14057.        -->  atpRspBuf   {pointer to response message buffer}
  14058.        -->  atpRspSize  {size of response message buffer}
  14059.  
  14060. ATPResponse is functionally analogous to ATPSndRsp. It sends a
  14061. response to a socket, but doesn't require the caller to provide a BDS.
  14062. ATPAddress must contain the complete network address of the socket to
  14063. which the response should be sent (the socket on which the corresponding
  14064. ATPGetRequest was issued). ATPRspBuf points to the buffer containing
  14065. the response message; the size of this buffer must be passed in
  14066. atpRspSize. The four user bytes to be sent in the ATP header of the
  14067. first response packet are passed in atpRspUData. The last packet of
  14068. the transaction response is sent with the EOM flag set.
  14069.  
  14070. Although you don't provide a BDS, ATPResponse in fact creates one and
  14071. calls the .ATP driver (as in an ATPSndRsp call). For this reason, the
  14072. abRecord fields atpRspBDSPtr and atpNumBufs are used by ATPResponse;
  14073. you should not expect these fields to remain unaltered during or after
  14074. the function's execution.
  14075.  
  14076. During exactly-once transactions ATPResponse won't complete until the
  14077. release packet is received or the release timer expires.
  14078.  
  14079. (warning)
  14080.     The maximum permissible size of the response message is
  14081.     4624 bytes.
  14082.  
  14083.  
  14084.     Result codes    noErr       No error
  14085.             badATPSkt   Bad responding socket
  14086.             noRelErr    No release received
  14087.             atpLenErr   Response too big
  14088.                 sktClosed   Socket closed by a cancel call
  14089.             noDataArea  Too many outstanding ATP calls
  14090.  
  14091.  
  14092.  
  14093.  
  14094. \ ATPRspCancel
  14095. 23
  14096. FUNCTION ATPRspCancel (abRecord: ABRecHandle; async: BOOLEAN) :
  14097.         OSErr;   [Not in ROM]
  14098.  
  14099. Given the handle to the ABusRecord of a previously made ATPSndRsp or
  14100. ATPResponse call, ATPRspCancel dequeues the ATPSndRsp or ATPResponse
  14101. call, provided that the call hasn't already completed. ATPRspCancel
  14102. returns noErr if the ATPSndRsp or ATPResponse call is successfully
  14103. removed from the queue. If it returns cbNotFound, check the abResult
  14104. field of abRecord to verify that the ATPSndRsp or ATPResponse call has
  14105. been completed and determine its outcome.
  14106.  
  14107.  
  14108.     Result codes    noErr       No error
  14109.             cbNotFound  ATP control block not found
  14110.             noDataArea  Too many outstanding ATP calls
  14111.  
  14112.  
  14113.  
  14114.  
  14115. \ NBPRegister
  14116. 23
  14117. FUNCTION NBPRegister (abRecord: ABRecHandle; async: BOOLEAN) :
  14118.         OSErr;   [Not in ROM]
  14119.  
  14120.  
  14121.     ABusRecord
  14122.     ----------
  14123.        <--  abOpcode        {always tNBPRegister}
  14124.        <--  abResult        {result code}
  14125.        -->  abUserReference     {for your use}
  14126.        -->  nbpEntityPtr        {pointer to entity name}
  14127.        -->  nbpBufPtr       {pointer to buffer}
  14128.        -->  nbpBufSize      {buffer size in bytes}
  14129.        -->  nbpAddress.aSocket  {socket address}
  14130.        -->  nbpRetransmitInfo   {retransmission information}
  14131.  
  14132. NBPRegister adds the name and address of an entity to the node's names
  14133. table. NBPEntityPtr points to a variable of type EntityName containing
  14134. the entity's name. If the name is already registered, NBPRegister
  14135. returns the result code nbpDuplicate. NBPBufPtr and nbpBufSize
  14136. specify the location and size of a buffer for NBP to use internally.
  14137. The buffer must contain at least 12 bytes plus the length of the entity
  14138. name.
  14139.  
  14140. (warning)
  14141.     This buffer must not be altered or released until the
  14142.     name is removed from the names table via an NBPRemove
  14143.     call. If you allocate the buffer through a NewHandle
  14144.     call, the handle must be locked as long as the name is
  14145.     registered.
  14146.  
  14147.     Result codes    noErr       No error
  14148.             nbpDuplicate    Duplicate name already exists
  14149.  
  14150.  
  14151.  
  14152.  
  14153. \ NBPLookup
  14154. 23
  14155. FUNCTION NBPLookup (abRecord: ABRecHandle; async: BOOLEAN) :
  14156.         OSErr;   [Not in ROM]
  14157.  
  14158.  
  14159.     ABusRecord
  14160.     ----------
  14161.        <--  abOpcode        {always tNBPLookup}
  14162.        <--  abResult        {result code}
  14163.        -->  abUserReference     {for your use}
  14164.        -->  nbpEntityPtr        {pointer to entity name}
  14165.        -->  nbpBufPtr       {pointer to buffer}
  14166.        -->  nbpBufSize      {buffer size in bytes}
  14167.        <->  nbpDataField        {number of addresses received}
  14168.        -->  nbpRetransmitInfo   {retransmission information}
  14169.  
  14170. NBPLookup returns the addresses of all entities with a specified name.
  14171. NBPEntityPtr points to a variable of type EntityName containing the
  14172. name of the entity whose address should be returned. (Meta-characters
  14173. are allowed in the entity name.)  NBPBufPtr and NBPBufSize contain the
  14174. location and size of an area of memory in which the entities' addresses
  14175. should be returned. NBPDataField indicates the maximum number of
  14176. matching names to find addresses for; the actual number of addresses
  14177. found is returned in NBPDataField. NBPRetransmitInfo contains the
  14178. retry interval and the retry count.
  14179.  
  14180.     Result codes    noErr       No error
  14181.             nbpBuffOvr  Buffer overflow
  14182.  
  14183.  
  14184.  
  14185. \ NBPExtract
  14186. 23
  14187. FUNCTION NBPExtract (theBuffer: Ptr; numInBuf: INTEGER; whichOne:
  14188.         INTEGER; VAR abEntityName; VAR address: AddrBlock)
  14189.         : OSErr;   [Not in ROM]
  14190.  
  14191. NBPExtract retruns one address from the list of addresses returned by
  14192. NBPLookup. TheBuffer and numInBuf indicate the location and number of
  14193. tuples in the buffer. WhichOne specifies which one of the tuples in
  14194. the buffer should be returned in the abEntity and adress parameters.
  14195.  
  14196.     Result codes    noErr       No error
  14197.             extractErr  Can't find tuple in buffer
  14198.  
  14199.  
  14200.  
  14201. \ NBPConfirm
  14202. 23
  14203. FUNCTION NBPConfirm (abRecord: ABRecHandle; async: BOOLEAN) :
  14204.         OSErr;   [Not in ROM]
  14205.  
  14206.     ABusRecord
  14207.     ----------
  14208.        <--  abOpcode        {always tNBPConfirm}
  14209.        <--  abResult        {result code}
  14210.        -->  abUserReference     {for your use}
  14211.        -->  nbpEntityPtr        {pointer to entity name}
  14212.        <--  nbpDataField        {number of addresses received}
  14213.        -->  nbpAddress      {socket address}
  14214.        -->  nbpRetransmitInfo   {retransmission information}
  14215.  
  14216. NBPConfirm confirms that an entity known by name and address still
  14217. exists (is still entered in the names directory). NBPEntityPtr points
  14218. to a variable of type EntityName that contains the name to confirm, and
  14219. nbpAddress specifies the address to be confirmed. (No meta-characters
  14220. are allowed in the entity name.)  NBPRetransmitInfo contains the retry
  14221. interval and the retry count. The correct socket number of the entity
  14222. is returned in nbpDataField. NBPConfirm is more efficient than
  14223. NBPLookup in terms of network traffic.
  14224.  
  14225.  
  14226.     Result codes    noErr       No error
  14227.             nbpConfDiff Name confirmed for different socket
  14228.             nbpNoConfirm    Name not confirmed
  14229.  
  14230.  
  14231.  
  14232. \ NBPRemove
  14233. 23
  14234. FUNCTION NBPRemove (abEntity: EntityPtr) : OSErr;   [Not in ROM]
  14235.  
  14236. NBPRemove removes an entity name from the names table of the caller's
  14237. node.
  14238.  
  14239.  
  14240.     Result codes    noErr       No error
  14241.             nbpNotFound Name not found
  14242.  
  14243.  
  14244.  
  14245. \ NBPLoad
  14246. 23
  14247. FUNCTION NBPLoad : OSErr;   [Not in ROM]
  14248.  
  14249. On a Macintosh 128K, NBPLoad reads the AppleTalk Manager's NBP code
  14250. from the system resource file into the application heap. On a
  14251. Macintosh 512K or XL, NBPLoad has no effect since the NBP code should
  14252. have already been loaded when the .MPP driver was opened. Normally
  14253. you'll never need to call NBPLoad because the AppleTalk Manager calls
  14254. it when necessary.
  14255.  
  14256.     Result codes    noErr       No error
  14257.  
  14258.  
  14259.  
  14260. \ NBPUnload
  14261. 23
  14262. FUNCTION NBPUnload : OSErr;   [Not in ROM]
  14263.  
  14264. NBPUnload makes the NBP code purgeable; the space isn't actually
  14265. released by the Memory Manager until necessary.
  14266.  
  14267. (note)
  14268.     This call applies only to a Macintosh 128K; on a
  14269.     Macintosh 521K or Macintosh XL, NBPUnload has no effect.
  14270.  
  14271.     Result codes    noErr       No error
  14272.  
  14273.  
  14274.  
  14275.  
  14276. \ GetNodeAddress
  14277. 23
  14278. FUNCTION GetNodeAddress (VAR myNode,myNet: INTEGER) : OSErr;[Not in ROM]
  14279.  
  14280. GetNodeAddress returns the current node ID and network number of the
  14281. caller. If the .MPP driver isn't installed, it returns noMPPErr. If
  14282. myNet contains 0, this means that a bridge hasn't yet been found.
  14283.  
  14284.     Result codes    noErr       No error
  14285.             noMPPErr    MP driver not installed
  14286.  
  14287.  
  14288.  
  14289. \ IsMPPOpen
  14290. 23
  14291. FUNCTION IsMPPOpen : BOOLEAN;   [Not in ROM]
  14292.  
  14293. IsMPPOpen returns TRUE if the .MPP driver is loaded and running.
  14294.  
  14295.  
  14296.  
  14297. \ IsATPOpen
  14298. 23
  14299. IsATPOpen : BOOLEAN;   [Not in ROM]
  14300.  
  14301. IsATPOpen returns TRUE if the .ATP driver is loaded and running.
  14302.  
  14303.  
  14304. \ VInstall
  14305. 24
  14306. FUNCTION VInstall (vblTaskPtr: QElemPtr) : OSErr;
  14307.  
  14308.     _________________________________________________________________
  14309.  
  14310.     Trap macro  _VInstall
  14311.  
  14312.     On entry    A0:  vblTaskPtr (pointer)
  14313.  
  14314.     On exit     D0:  result code (integer)
  14315.     _________________________________________________________________
  14316.  
  14317.     VInstall adds the task described by vblTaskPtr to the vertical
  14318. retrace queue. Your application must fill in all fields of the task
  14319. except qLink. VInstall returns one of the result codes listed below.
  14320.  
  14321.     Result codes
  14322.  
  14323.             noErr       No error
  14324.             vTypErr     QType field isn't ORD(vType)
  14325.  
  14326. \ VRemove
  14327. 24
  14328. FUNCTION VRemove (vblTaskPtr: QElemPtr) : OSErr;
  14329.  
  14330.     _________________________________________________________________
  14331.  
  14332.     Trap macro  _VRemove
  14333.  
  14334.     On entry    A0:  vblTaskPtr (pointer)
  14335.  
  14336.     On exit     D0:  result code (integer)
  14337.     _________________________________________________________________
  14338.  
  14339.  
  14340.     Result codes
  14341.  
  14342.             noErr       No error
  14343.             vTypErr     QType field isn't ORD(vType)
  14344.             qErr        Task entry isn't in the queue
  14345. \ GetVBLQHdr
  14346. 24
  14347. FUNCTION GetVBLQHdr : QHdrPtr;   [Pascal only]
  14348.  
  14349.     GetVBLQHdr returns a pointer to the vertical retrace queue.
  14350. \ HandToHand
  14351. 25
  14352. FUNCTION HandToHand (VAR theHndl: Handle) : OSErr;
  14353.  
  14354.     _________________________________________________________________
  14355.  
  14356.     Trap macro  _HandToHand
  14357.  
  14358.     On entry    A0:  theHndl (handle)
  14359.  
  14360.     On exit     A0:  theHndl (handle)
  14361.                 D0:  result code (word)
  14362.     __________________________________________________________________
  14363.  
  14364.     HandToHand copies the information to which theHndl is a handle and
  14365. returns a new handle to the copy in theHndl. Since HandToHand replaces
  14366. the input parameter with a new handle, you should retain the original
  14367. value of the input parameter somewhere else, or you won't be able to
  14368. access it. For example:
  14369.  
  14370.     VAR x,y: Handle;
  14371.         err: OSErr;
  14372.  
  14373.     y := x;
  14374.     err := HandToHand(y)
  14375.  
  14376.     The original handle remains in x while y becomes a different handle
  14377. to identical data.
  14378.  
  14379.     Result codes
  14380.  
  14381.             noErr       No error
  14382.             memFullErr  Not enough room in heap
  14383.             nilHandleErr    NIL master pointer
  14384.             memWZErr    Attempt to operate on a free block
  14385. \ PtrToHand
  14386. 25
  14387. FUNCTION PtrToHand (srcPtr: Ptr; VAR dstHndl: Handle; size: LONGINT) :
  14388.         OSErr;
  14389.  
  14390.     __________________________________________________________________
  14391.  
  14392.     Trap macro  _PtrToHand
  14393.  
  14394.     On entry    A0:  srcPtr (pointer)
  14395.                 D0:  size (long word)
  14396.  
  14397.     On exit     A0:  dstHndl (handle)
  14398.                 D0:  result code (word)
  14399.     ___________________________________________________________________
  14400.  
  14401.  
  14402.  
  14403.  
  14404.  
  14405.     PtrToHand returns in dstHndl a newly created handle to a copy of the
  14406. number of bytes specified by the size parameter, beginning at the
  14407. location specified by srcPtr.
  14408.  
  14409.     Result codes
  14410.  
  14411.             noErr       No error
  14412.             memFullErr  Not enough room in heap
  14413. \ PtrToXHand
  14414. 25
  14415. FUNCTION PtrToXHand (srcPtr: Ptr; VAR dstHndl: Handle; size: LONGINT) :
  14416.                     OSErr;
  14417.  
  14418.  
  14419.     __________________________________________________________________
  14420.  
  14421.     Trap macro  _PtrToXHand
  14422.  
  14423.     On entry    A0:  srcPtr (pointer)
  14424.                 A1:  dstHndl (handle)
  14425.                 D0:  size (long word)
  14426.  
  14427.     On exit     A1:  dstHndl (handle)
  14428.                 D0:  result code (word)
  14429.     ___________________________________________________________________
  14430.  
  14431.     PtrToXHand takes the existing handle specified by dstHndl and makes
  14432. it a handle to a copy of the number of bytes specified by the size
  14433. parameter, beginning at the location specified by srcPtr.
  14434.  
  14435.     Result codes
  14436.  
  14437.             noErr       No error
  14438.             memFullErr  Not enough room in heap
  14439.             nilHandleErr    NIL master pointer
  14440.             memWZErr    Attempt to operate on a free block
  14441. \ HandAndHand
  14442. 25
  14443. FUNCTION HandAndHand (aHndl,bHndl: Handle) : OSErr;
  14444.  
  14445.     __________________________________________________________________
  14446.  
  14447.     Trap macro  _PtrToXHand
  14448.  
  14449.     On entry    A0:  aHndl (handle)
  14450.                 A1:  bHndl (handle)
  14451.  
  14452.     On exit     A1:  bHndl (handle)
  14453.                 D0:  result code (word)
  14454.     ___________________________________________________________________
  14455.  
  14456.     HandAndHand concatenates the information to which aHndl is a handle
  14457. onto the end of the information to which bHndl is a handle.
  14458.  
  14459.  
  14460.     Result codes
  14461.  
  14462.             noErr       No error
  14463.             memFullErr  Not enough room in heap
  14464.             nilHandleErr    NIL master pointer
  14465.             memWZErr    Attempt to operate on a free block
  14466. \ PtrAndHand
  14467. 25
  14468. FUNCTION PtrAndHand (pntr: Ptr; hndlk: Handle; size: LONGINT) : OSErr;
  14469.  
  14470.     __________________________________________________________________
  14471.  
  14472.     Trap macro  _PtrToXHand
  14473.  
  14474.     On entry    A0:  pntr (pointer)
  14475.                 A1:  hndl (handle)
  14476.                 D0:  size (long word)
  14477.  
  14478.     On exit     A1:  hndl (handle)
  14479.                 D0:  result code (word)
  14480.     ___________________________________________________________________
  14481.  
  14482.     PtrAndHand takes the number of bytes specified by the size
  14483. parameter, beginning at the location specified by pntr, and concatenates
  14484. them onto the end of the information to which hndl is a handle.
  14485.  
  14486.     Result codes
  14487.  
  14488.             noErr       No error
  14489.             memFullErr  Not enough room in heap
  14490.             nilHandleErr    NIL master pointer
  14491.             memWZErr    Attempt to operate on a free block
  14492. \ NGetTrapAddress
  14493. 25
  14494. FUNCTION NGetTrapAddress (trapNum: INTEGER; tType: TrapType) : LongInt;
  14495.                             [Not in ROM]
  14496.  
  14497.     NGetTrapAddress is identical to GetTrapAddress except that it
  14498. requires you to specify in tType whether the given routine is an
  14499. Operating System or a Toolbox trap.
  14500.  
  14501. Trap macro  _GetTrapAddress ,NEWOS      (bit 9 set, bit 10 clear)
  14502.             _GetTrapAddress ,NEWTOOL    (bit 9 set, bit 10 set)
  14503.  
  14504. On entry    D0:  trapNum (word)
  14505.  
  14506. On exit     A0:  address of routine
  14507. \ NSetTrapAddress
  14508. 25
  14509. FUNCTION NSetTrapAddress (trapAddr: LongInt; trapNum: INTEGER;
  14510.                             tType: TrapType);  [Not in ROM]
  14511.  
  14512.     NSetTrapAddress is identical to SetTrapAddress except that it
  14513. requires you to specify in tType whether the given routine is an
  14514. Operating System or a Toolbox trap.
  14515.  
  14516. Trap macro  _SetTrapAddress ,NEWOS      (bit 9 set, bit 10 clear)
  14517.             _SetTrapAddress ,NEWTOOL    (bit 9 set, bit 10 set)
  14518.  
  14519. On entry    A0:  trapAddr (address)
  14520.             D0:  trapNum (word)
  14521. \ RelString
  14522. 25
  14523. FUNCTION RelString (aStr,bStr: Str255; caseSens,diacSens: BOOLEAN)
  14524.                     : INTEGER;
  14525.  
  14526.     RelString is similar to EqualString except that it indicates whether
  14527. the first string is less than, equal to, or greater than the second
  14528. string by returning either –1, 0, or 1 respectively.
  14529.  
  14530.  
  14531. Trap macro  _RelString
  14532.             _RelString ,MARKS       (sets bit 9, for diacSens=FALSE)
  14533.             _RelString ,CASE        (sets bit 10, for caseSens=TRUE)
  14534.             _RelString ,MARKS,CASE  (sets bits 9 and 10)
  14535.  
  14536. On entry    A0:  pointer to first character of first string
  14537.             A1:  pointer to first character of second string
  14538.             D0:  high-order word:  length of first string
  14539.                  low-order word:  length of second string
  14540.  
  14541. On exit D0:    –1 if first string less than second,
  14542.                 0 if equal,
  14543.                 1 if first string greater than second (long word)
  14544.  
  14545.  
  14546.     RelString follows the sort order described in chapter 19 of
  14547. Volume II except for the reordering of the following ligatures:
  14548.  
  14549. Æ falls between Å and a
  14550. æ falls between å and B
  14551. Œ falls between Ø and o
  14552. œ falls between ø and P
  14553. ß falls between s and T
  14554.  
  14555.     If diacSens is FALSE, diacritical marks are ignored; RelString
  14556. strips diacriticals according to the following table:
  14557.  
  14558. A   <—  Ä, Å, À, Ã
  14559. C   <—  Ç
  14560. E   <—  É
  14561. N   <—  Ñ
  14562. O   <—  Ö, Õ, Ø
  14563. U   <—  Ü
  14564. a   <—  á, à, â, ä, ã, å, ª
  14565. c   <—  ç
  14566. e   <—  é, è, ê, ë
  14567. i   <—  í, ì, î, ï
  14568. n   <—  ñ
  14569. o   <—  ó, ò, ô, ö, õ, ø, º
  14570. u   <—  ú, ù, û, ü
  14571. y   <—  ÿ
  14572.  
  14573. Note:   This stripping is identical to that performed by the UprString
  14574.         procedure when the diacSens parameter is FALSE.
  14575.  
  14576.     If caseSens is FALSE, the comparison is not case-sensitive;
  14577. RelString performs a conversion from lower-case to upper-case characters
  14578. according to the following table:
  14579.  
  14580. A   <—  a
  14581. . . .   <—  . . .
  14582. Z   <—  z
  14583. À   <—  à
  14584. à  <—  ã
  14585. Ä   <—  ä
  14586. Å   <—  å
  14587. Æ   <—  æ
  14588. Ç   <—  ç
  14589. É   <—  é
  14590. Ñ   <—  ñ
  14591. Ö   <—  ö
  14592. Õ   <—  õ
  14593. Ø   <—  ø
  14594. Œ   <—  œ
  14595. Ü   <—  ü
  14596.  
  14597. Note:   This conversion is identical to that performed by the UprString
  14598.         procedure.
  14599.  
  14600. \ Environs
  14601. 25
  14602. PROCEDURE Environs (VAR rom,machine: INTEGER)  [Not in ROM]
  14603.  
  14604.     In the rom parameter, Environs returns the current ROM version
  14605. number (for a Macintosh XL, the version number of the ROM image
  14606. installed by MacWorks). To use the 128K ROM  information described
  14607. in this volume, the version number should be greater than or equal
  14608. to 117 ($75). In the machine parameter, Environs returns an indication
  14609. of which machine is in use, as follows:
  14610.  
  14611.  
  14612. CONST   macXLMachine    = 0;    {Macintosh XL}
  14613.         macMachine      = 1;    {Macintosh 128K, 512K, 512K upgraded, }
  14614.                                 { 512K enhanced, or Macintosh Plus}
  14615.  
  14616. Note:  The machine parameter does not distinguish between the Macintosh
  14617. 128K, 512K, 512K upgraded, 512K enhanced, and Macintosh Plus.
  14618. ________________________________________________________________________
  14619.  
  14620. Assembly-language note:  From assembly language, you can get this
  14621. information from the word that’s at an offset of 8 from the beginning
  14622. of ROM (which is stored in the global variable ROMBase). The format of
  14623. this word is $00xx for the Macintosh 128K, 512K, 512K upgraded, 512K
  14624. enhanced, or Macintosh Plus, and $xxFF for the Macintosh XL, where xx
  14625. is the ROM version number. (The ROM version number will always be
  14626. between $01 and $FE.)
  14627. ________________________________________________________________________
  14628.  
  14629. \ EqualString
  14630. 25
  14631. FUNCTION EqualString (aStr,bStr: Str255; caseSens,diacSens: BOOLEAN) :
  14632.                         BOOLEAN;
  14633.  
  14634.     _________________________________________________________________
  14635.  
  14636.     Trap macro  _CmpString
  14637.                 _CmpString  ,MARKS          (sets bit 9, for
  14638.                                              diacSens=FALSE)
  14639.                 _CmpString  ,CASE           (sets bit 10, for
  14640.                                              caseSens=TRUE)
  14641.                 _CmpString   ,MARKS,CASE    (sets bits 9 and 10)
  14642.  
  14643.  
  14644.     On entry    A0:  pointer to first character of first string
  14645.                 A1:  pointer to first character of second string
  14646.                 D0:  high-order word: length of first string
  14647.                      low-order word:  length of second string
  14648.  
  14649.     On exit     D0:  0 if strings equal, 1 if strings not equal
  14650.                     (long word)
  14651.     ___________________________________________________________________
  14652.  
  14653.     EqualString compares the two given strings for equality on the basis
  14654. of their ASCII values. If caseSens is TRUE, uppercase characters are
  14655. distinguished from the corresponding lowercase characters. If diacSens
  14656. is FALSE, diacritical marks are ignored dring the comparison. The
  14657. function returns TRUE if the strings are equal.
  14658.  
  14659. (note)
  14660.     See also the International Utilities Package function
  14661.     IUEqualString, as described in the Macintosh Packages
  14662.     manual.
  14663. \ UprString
  14664. 25
  14665. PROCEDURE UprString (VAR theString: Str255; diacSens: BOOLEAN);
  14666.  
  14667.     _________________________________________________________________
  14668.  
  14669.     Trap macro  _UprString
  14670.                 _UprString  ,MARKS  (sets bit 9, for diacSens=FALSE)
  14671.  
  14672.     On entry    A0:  pointer to first charactaer of string
  14673.                 D0:  length of string (word)
  14674.  
  14675.     On exit     A0:  pointer to first character of string
  14676.     __________________________________________________________________
  14677.  
  14678.     UprString converts any lowercase letters in the given string to
  14679. uppercase, returning the converted string in theString. In addition,
  14680. diacritical marks are stripped from the string if diacSens is FALSE.
  14681. \ ReadDateTime
  14682. 25
  14683. FUNCTION ReadDateTime (VAR secs: LONGINT) : OSErr;
  14684.  
  14685.     __________________________________________________________________
  14686.  
  14687.     Trap macro  _ReadDateTime
  14688.  
  14689.     On entry    A0:  pointer to long word secs
  14690.  
  14691.     On exit     A0:  pointer to long word secs
  14692.                 D0:  result code (word)
  14693.     __________________________________________________________________
  14694.  
  14695.     ReadDateTime copies the date and time stored in the clock chip to a
  14696. low-memory location and returns it in the secs parameter. This routine
  14697. is called at system startup; you'll probably never need to call it
  14698. yourself. Instead you'll call GetDateTime (see below).
  14699.  
  14700.     __________________________________________________________________
  14701.  
  14702.     Assembly-language note:  The low-memory location to which
  14703.     ReadDateTime copies the date and time is the global variable
  14704.     Time.
  14705.     __________________________________________________________________
  14706.  
  14707.  
  14708.     Result codes    noErr       No error
  14709.                     clkRdErr    Unable to read clock
  14710. \ GetDateTime
  14711. 25
  14712. PROCEDURE GetDateTime (VAR secs: LONGINT);   [Not in ROM]
  14713.  
  14714.     GetDateTime returns in the secs parameter the contents of the low-
  14715. memory location in which the date and time is stored; if the date and
  14716. time is properly set, secs will contain the number of seconds between
  14717. midnight, January 1, 1904 and the time that the function was called.
  14718.  
  14719. (note)
  14720.     If your application disables interrupts for longer than a
  14721.     second, the number of seconds returned will not be exact.
  14722.  
  14723.  
  14724.  
  14725.     ________________________________________________________________
  14726.  
  14727.     Assembly-language note:  Assembly-language programmers can just
  14728.     access the global variable Time.
  14729.     ________________________________________________________________
  14730.  
  14731.     If you wish, you can convert the value returned by GetDateTime to a
  14732. date/time record by calling the Secs2Date procedure.
  14733.  
  14734. (note)
  14735.     Passing the value returned by GetDateTime to the
  14736.     International Utilities Package procedure IUDateString or
  14737.     IUTimeString will yield a string representing the
  14738.     corresponding date or time of day, respectively.
  14739. \ SetDateTime
  14740. 25
  14741. FUNCTION SetDateTime (secs: LONGINT) : OSErr;
  14742.  
  14743.     _________________________________________________________________
  14744.  
  14745.     Trap macro  _SetDateTime
  14746.  
  14747.     On entry    D0:  secs (long word)
  14748.  
  14749.     On exit     D0:  result code (word)
  14750.     _________________________________________________________________
  14751.  
  14752.     SetDateTime takes a number of seconds since midnight, January 1,1904
  14753. as specified by the secs parameter and writes it to the clock chip as
  14754. the current date and time. It then attempts to read the value just
  14755. written and verify it by comparing it to the secs parameter.
  14756.  
  14757.     _________________________________________________________________
  14758.  
  14759.     Assembly-language note:  SetDateTime updates the global variable
  14760.     Time to the value of the secs parameter.
  14761.     _________________________________________________________________
  14762.  
  14763.  
  14764.     Result codes    noErr       No error
  14765.                     clkWrErr    Time written did not verify
  14766.                     clkRdErr    Unable to read clock
  14767. \ Date2Secs
  14768. 25
  14769. PROCEDURE Date2Secs (date: DateTimeRec; VAR secs: LONGINT);
  14770.  
  14771.     _________________________________________________________________
  14772.  
  14773.     Trap macro  _Date2Secs
  14774.  
  14775.     On entry    A0:  pointer to date/time record
  14776.  
  14777.     On exit     D0:  secs (long word)
  14778.     _________________________________________________________________
  14779.  
  14780.     Date2Secs takes the given date/time record, converts it to the
  14781. corresponding number of seconds elapsed since midnight, January 1,
  14782. 1904, and returns the result in the secs parameter. The dayOfWeek
  14783. field of the date/time record is ignored. The values passed in the
  14784. year and month fields should be within their allowable ranges, or
  14785. unpredictable results may occur. The remaining four fields of the
  14786. date/time record may contain any value. For example, September 35 will
  14787. be interpreted as October 4, and you could specify the 300th day of the
  14788. year as January 300.
  14789. \ Secs2Date
  14790. 25
  14791. PROCEDURE Secs2Date (secs: LONGINT; VAR date: DateTimeRec);
  14792.  
  14793.     ________________________________________________________________
  14794.  
  14795.     Trap macro  _Secs2Date
  14796.  
  14797.     On entry    D0:  secs (long word)
  14798.  
  14799.     On exit     A0:  pointer to date/time record
  14800.     ________________________________________________________________
  14801.  
  14802.  
  14803.     Secs2Date takes a number of seconds elapsed since midnight,
  14804. January 1, 1904 as specified by the secs parameter, converts it to the
  14805. corresponding date and time, and returns the corresponding date/time
  14806. record in the date parameter.
  14807. \ GetTime
  14808. 25
  14809. PROCEDURE GetTime (VAR date: DateTimeRec);   [Not in ROM]
  14810.  
  14811.     GetTime takes the number of seconds elapsed since midnight,
  14812. January 1, 1904 (obtained by calling GetDateTime), converts that value
  14813. into a date and time (by calling Secs2Date), and returns the result in
  14814. the date parameter.
  14815. \ SetTime
  14816. 25
  14817. PROCEDURE SetTime (date: DateTimeRec);   [Not in ROM]
  14818.  
  14819.     SetTime takes the date and time specified by the date parameter,
  14820. converts it into the corresponding number of seconds elapsed since
  14821. midnight, January 1, 1904 (by calling Date2Secs), and then writes that
  14822. value to the clock chip as the current date time (by calling
  14823. SetDateTime).
  14824. \ InitUtil
  14825. 25
  14826. FUNCTION InitUtil : OSErr;
  14827.  
  14828.     _________________________________________________________________
  14829.  
  14830.     Trap macro  _InitUtil
  14831.  
  14832.     On exit     D0:  result code (word)
  14833.     _________________________________________________________________
  14834.  
  14835.  
  14836.     InitUtil copies the contents of parameter RAM into 20 bytes of low
  14837. memory and copies the date and time from the clock chip into its own
  14838. low-memory location. This routine is called at system startup; you'll
  14839. probably never need to call it yourself.
  14840.  
  14841.  
  14842.     _________________________________________________________________
  14843.  
  14844.     Assembly-language note:  InitUtil copies parameter RAM into 20
  14845.     bytes starting at the address SysParam and copies the date and
  14846.     time into the global variable Time.
  14847.     _________________________________________________________________
  14848.  
  14849.     If the validity status in parameter RAM is not $A8 when InitUtil is
  14850. called, an error is returned as the result code, and the default values
  14851. (given earlier in the "ParameterRAM" section) are read into the los-
  14852. memory copy of parameter RAM; these values are then written to the
  14853. clock chip itself.
  14854.  
  14855.     Result codes    noErr       No error
  14856.                     prInitErr   Validity status not $A8
  14857. \ GetSysPPtr
  14858. 25
  14859. FUNCTION GetSysPPtr : SysPPtr;   [Not in ROM]
  14860.  
  14861.     GetSysPPtr returns a pointer to the low-memory copy of parameter
  14862. RAM. You can examine the values stored in its various fields, or to
  14863. change them before calling WriteParam (below).
  14864. \ WriteParam
  14865. 25
  14866. FUNCTION WriteParam : OSErr;
  14867.  
  14868.     _________________________________________________________________
  14869.  
  14870.     Trap macro  _WriteParam
  14871.  
  14872.     On entry    A0:  SysParam (pointer)
  14873.                 D0:  MinusOne (long word)
  14874.  
  14875.                  (You have to pass the values of these global
  14876.                   variables for historical reasons.)
  14877.  
  14878.     On exit     D0:  result code (word)
  14879.     _________________________________________________________________
  14880.  
  14881.  
  14882.     WriteParam writes the low-memory copy of parameter RAM to the clock
  14883. chip. You should previously have called GetSysPPtr and changed
  14884. selected values as desired.
  14885.  
  14886.     WriteParam also attempts to verify the values written by reading
  14887. them back in and comparing them to the values in the low-memory copy.
  14888.  
  14889. (note)
  14890.     If you've accidentally written incorrect values into
  14891.     parameter RAM, the system may not be able to start up.
  14892.     If this happens, you can reset parameter RAM by removing
  14893.     the battery, letting the Macintosh sit turned off for
  14894.     about five minutes, and then putting the battery back in.
  14895.  
  14896.  
  14897.     Result code noErr       No error
  14898.                 prWrErr     Parameter RAM written did not verify
  14899. \ Enqueue
  14900. 25
  14901. PROCEDURE Enqueue (qElement: QElemPtr; theQueue: QHdrPtr);
  14902.  
  14903.     ________________________________________________________________
  14904.  
  14905.     Trap macro  _Enqueue
  14906.  
  14907.     On entry    A0:  qElement (pointer)
  14908.                 A1:  theQueue (pointer)
  14909.  
  14910.     On exit     A1:  theQueue (pointer)
  14911.     ________________________________________________________________
  14912.  
  14913.     Enqueue adds the queue entry pointer to by qElement to the end of
  14914. the queue specified by theQueue.
  14915.  
  14916. (note)
  14917.     Interrupts are disabled for a short time while the queue
  14918.     is updated.
  14919. \ Dequeue
  14920. 25
  14921. FUNCTION Dequeue (qElement: QElemPtr; theQueue: QHdrPtr) : OSErr;
  14922.  
  14923.     _________________________________________________________________
  14924.  
  14925.     Trap macro  _Dequeue
  14926.  
  14927.     On entry    A0:  qElement (pointer)
  14928.                 A1:  theQueue (pointer)
  14929.  
  14930.     On exit     A1:  theQueue (pointer)
  14931.                 D0:  result code (word)
  14932.     _________________________________________________________________
  14933.  
  14934.  
  14935.     Dequeue removes the queue entry pointed to by qElement from the
  14936. queue specified by theQueue (without deallocating the entry) and adjusts
  14937. other entries in the queue accordingly.
  14938.  
  14939. (note)
  14940.     The note under Enqueue above also applies here. In this
  14941.     case, the amount of time interrupts are disabled depends
  14942.     on the length of the queue and the position of the entry
  14943.     in the queue.
  14944.  
  14945. (note)
  14946.     To remove all entries from a queue, you can just clear
  14947.     all the fields of the queue's header.
  14948.  
  14949.  
  14950.     Result codes    noErr       No error
  14951.                     qErr        Entry not in specified queue
  14952.  
  14953.  
  14954.  
  14955.  
  14956. \ GetTrapAddress
  14957. 25
  14958. FUNCTION GetTrapAddress (trapNum: INTEGER) : LONGINT;
  14959.  
  14960.     _________________________________________________________________
  14961.  
  14962.     Trap macro  _GetTrapAddress
  14963.  
  14964.     On entry    D0:  trapNum (word)
  14965.  
  14966.     On exit     A0:  address of routine
  14967.     _________________________________________________________________
  14968.  
  14969.  
  14970.     GetTrapAddress returns the address of a routine currently installed
  14971. in the trap dispatch table under the trap number designated by trapNum.
  14972. To find out the trap number for a particular routine, see Appendix B.
  14973. \ SetTrapAddress
  14974. 25
  14975. PROCEDURE SetTrapAddress (trapAddr: LONGINT; trapNum: INTEGER);
  14976.  
  14977.  
  14978.     _________________________________________________________________
  14979.  
  14980.     Trap macro  _SetTrapAddress
  14981.  
  14982.     On entry    A0:  trapAddr (address)
  14983.                 D0:  trapNum (word)
  14984.     _________________________________________________________________
  14985.  
  14986.  
  14987.     SetTrapAddress installs in the trap dispatch table a routine whose
  14988. address is trapAddr; this routine is installed under the trap number
  14989. designated by trapNum.
  14990.  
  14991. (note)
  14992.     Remember, the trap dispatch table can address locations
  14993.     within a range of 64K bytes from the base address of ROM
  14994.     or RAM.
  14995. \ Delay
  14996. 25
  14997. PROCEDURE Delay (numTicks: LONGINT; VAR finalTicks: LONGINT);
  14998.  
  14999.     _______________________________________________________________
  15000.  
  15001.     Trap macro  _Delay
  15002.  
  15003.     On entry    A0:  numTicks (long word)
  15004.  
  15005.     On exit     D0:  finalTicks (long word)
  15006.     _______________________________________________________________
  15007.  
  15008.     Delay causes the system to wait for the number of ticks (sixtieths
  15009. of a second) specified by numTicks, and returns in finalTicks the total
  15010. number of ticks from system startup to the end of the delay.
  15011.  
  15012. (warning)
  15013.     Do not rely on the duration of the delay being exact; it
  15014.     will usually be accurate within one tick, but may be off
  15015.     more than that. The Delay procedure enables all
  15016.     interrupts and checks the tick count that's incremented
  15017.     during the vertical retrace interrupt; however, it's
  15018.     possible for this interrupt to be disabled by other
  15019.     interrupts, in which case the duration of the delay will
  15020.     not be exactly what you requested.
  15021. \ SysBeep
  15022. 25
  15023. PROCEDURE SysBeep (duration: INTEGER);
  15024.  
  15025.     SysBeep causes the system to beep for approximately the number of
  15026. ticks specified by the duration parameter. The sound decays from loud
  15027. to soft; after about five seconds it's inaudible. The initial volume of
  15028. the beep depends on the current speaker volume setting, which the user
  15029. can adjust with the Control Panel desk accessory. If the speaker
  15030. volume has been set to 0 (silent), SysBeep instead causes the menu bar
  15031. to blink once.
  15032. \ LNew
  15033. 26
  15034. FUNCTION LNew (rView,dataBounds: Rect; cSize: Point; theProc: INTEGER;
  15035.                 theWindow: WindowPtr; drawIt,hasGrow,
  15036.                 scrollHoriz,scrollVert: BOOLEAN) : ListHandle;
  15037.  
  15038.     Call LNew to create a new list. It returns a handle to the new list.
  15039. The list’s grafPort is set to theWindow’s port. If drawIt is FALSE,
  15040. the list is not displayed.
  15041.  
  15042.     RView specifies, in the local coordinates of theWindow, the
  15043. rectangle in which the list will be displayed. (Remember that this
  15044. doesn’t include space for scroll bars. If the list, including scroll
  15045. bars, is to fill the entire window, rView should be 15 points smaller in
  15046. each dimension than theWindow’s portRect.)
  15047.  
  15048.     DataBounds is the rectangle for specifying the initial array
  15049. dimensions of the list. For example to preallocate space for a list
  15050. that’s 5 cells across by 10 cells down, you should set dataBounds to
  15051. (0,0)(5,10). If you want to allocate the space for a one-column list,
  15052. set dataBounds to (0,0)(1,0) and use LAddRow.
  15053.  
  15054.     CSize.h and cSize.v are the desired height and width of each cell in
  15055. pixels; if they’re not specified, a default cell size is calculated
  15056. (as described above).
  15057.  
  15058.     TheProc is the resource ID of your list definition procedure; for
  15059. a text-only list, pass 0 and the default list definition procedure
  15060. (about 150 bytes in size) will be used. The list definition procedure
  15061. is called to initialize itself after all other list record fields have
  15062. been initialized; thus, it can use any of the values in the list record
  15063. (or set particular fields, such as the indent distance).
  15064.  
  15065.     If hasGrow is TRUE, the scroll bars are sized so that there’s room
  15066. for a size box in the standard position. It’s up to the program to
  15067. display the size box (using the Window Manager procedure DrawGrowIcon).
  15068. If scrollHoriz is TRUE, a horizontal scroll bar is placed immediately
  15069. below rView and all horizontal scrolling functions are implemented.
  15070. If scrollVert is TRUE, a vertical scroll bar is placed immediately to
  15071. the right of rView and all vertical scrolling functions are implemented.
  15072.  
  15073.     The visible rectangle is set to contain as many cells of cSize
  15074. (or the default) as will fit into rView. If the cells do not fit
  15075. exactly into rView, the visible rectangle is rounded up to the nearest
  15076. cell. Scrolling will always allow all cells to be fully displayed.
  15077. The selection flags are set to 0, and the active flag is set to TRUE.
  15078.  
  15079.  
  15080. Note:  Scrolling looks best if rView is a multiple of cSize.v in height.
  15081.  
  15082. \ LDispose
  15083. 26
  15084. PROCEDURE LDispose (lHandle: ListHandle);
  15085.  
  15086.     Call LDispose when you are through using a list. It issues a close
  15087. call to the list definition procedure, and calls the Memory Manager
  15088. procedure DisposHandle for the data handle, the Control Manager
  15089. procedure DisposeControl for both scroll bars (if they’re there), and
  15090. DisposHandle for the list record.
  15091.  
  15092. Note:  Calling LDispose is much faster than deleting one row at a time.
  15093.  
  15094. \ LAddColumn
  15095. 26
  15096. FUNCTION LAddColumn (count,colNum: INTEGER; lHandle: ListHandle)
  15097.                     : INTEGER;
  15098.  
  15099.     LAddColumn inserts into the given list the number of columns
  15100. specified by the count parameter, starting at the column specified by
  15101. colNum. Column numbers that are greater than or equal to colNum are
  15102. increased by count. If colNum is not within dataBounds, new last
  15103. columns are added. The number of the first added column is returned
  15104. and dataBounds.right is increased by count. All cells added are empty.
  15105. If there are no cells (because dataBounds.top = dataBounds.bottom), no
  15106. cells are added, but dataBounds is still extended. If drawing is on and
  15107. the added columns (which are empty) are visible, the list and its
  15108. scrollbars are updated.
  15109.  
  15110. \ LAddRow
  15111. 26
  15112. FUNCTION LAddRow (count,rowNum: INTEGER; lHandle: ListHandle) : INTEGER;
  15113.  
  15114.     LAddRow inserts the number of rows specified by the count parameter,
  15115. starting at the row specified by rowNum. Row numbers that are greater
  15116. than or equal to rowNum are increased by count. If rowNum is not within
  15117. dataBounds, new last rows are added. The number of the first added row
  15118. is returned, and dataBounds.bottom is increased by count. All cells
  15119. added are empty. If there are no cells (because dataBounds.left =
  15120. dataBounds.right), no cells are added, but dataBounds is still extended.
  15121. If drawing is on and the added rows (which are empty) are visible, the
  15122. list and its scroll bars are updated.
  15123.  
  15124. \ LDelColumn
  15125. 26
  15126. PROCEDURE LDelColumn (count,colNum: INTEGER; lHandle: ListHandle);
  15127.  
  15128.     LDelColumn deletes the number of columns specified by the count
  15129. parameter, starting with the column specified by colNum. Column
  15130. numbers that are greater than colNum are decreased by count. If colNum
  15131. is not within dataBounds, nothing is done. DataBounds.right is
  15132. decreased by count. If drawing is on and the deleted columns were
  15133. visible, the list and its scroll bars are updated.
  15134.  
  15135.     If count is 0, or colNum = dataBounds.left AND count  > =
  15136. dataBounds.right – dataBounds.left all the data in the list is quickly
  15137. deleted, dataBounds.right is set to dataBounds.left, and the number of
  15138. rows is left unchanged.
  15139.  
  15140. \ LDelRow
  15141. 26
  15142. PROCEDURE LDelRow (count,rowNum: INTEGER; lHandle: ListHandle);
  15143.  
  15144.     LDelRow deletes the number of rows specified by the count parameter,
  15145. starting with the row specified by rowNum. Row numbers that are greater
  15146. than rowNum are decreased by count. If rowNum is not within dataBounds,
  15147. nothing is done. DataBounds.bottom is decreased by count. If drawing
  15148. is on and the deleted rows were visible, the list and its scroll bars
  15149. are updated.
  15150.  
  15151.     If count is 0, or rowNum = dataBounds.top AND count > =
  15152. dataBounds.bottom – dataBounds.top all the data in the list is quickly
  15153. deleted, dataBounds.bottom is set to dataBounds.top, and the number of
  15154. columns is left unchanged.
  15155.  
  15156. \ LAddToCell
  15157. 26
  15158. PROCEDURE LAddToCell (dataPtr: Ptr; dataLen: INTEGER; theCell: Cell;
  15159.                         lHandle: ListHandle);
  15160.  
  15161.     LAddToCell appends the data pointed to by dataPtr and of length
  15162. dataLen to the cell specified by theCell in lHandle. If drawing is off,
  15163. you must turn drawing on and call LDraw (or LUpdate) to display the
  15164. cell’s new value.
  15165.  
  15166. \ LClrCell
  15167. 26
  15168. PROCEDURE LClrCell (theCell: Cell; lHandle: ListHandle);
  15169.  
  15170.     LClrCell clears the contents of the specified cell (by setting the
  15171. length to 0). If theCell is not a valid cell, nothing is done. If
  15172. drawing is off, you must turn drawing on and call LDraw to display
  15173. the cell’s new value (or simply call the Window Manager procedure
  15174. InvalRect).
  15175.  
  15176. \ LGetCell
  15177. 26
  15178. PROCEDURE LGetCell (dataPtr: Ptr; VAR dataLen: INTEGER; theCell: Cell;
  15179.                     lHandle: ListHandle);
  15180.  
  15181.     Given a cell in theCell, LGetCell copies the cell’s data to the
  15182. location specified by dataPtr; dataLen is the maximum number of bytes
  15183. allowed. If the data is longer than dataLen, only dataLen bytes are
  15184. copied into the location specified by dataPtr. If the data is shorter
  15185. than dataLen, dataLen is set to the true length of the cell’s data.
  15186.  
  15187. \ LSetCell
  15188. 26
  15189. PROCEDURE LSetCell (dataPtr: Ptr; dataLen: INTEGER; theCell: Cell;
  15190.                     lHandle: ListHandle);
  15191.  
  15192.     LSetCell places the data pointed to by dataPtr and of length dataLen
  15193. into the specified cell. It replaces any data that was already in the
  15194. cell. If dataLen is 0, this is equivalent to LClrCell. If theCell is
  15195. not a valid cell, nothing is done. If drawing is off, you must turn
  15196. drawing on and call LDraw (or LUpdate) to display the cell’s new value.
  15197.  
  15198. \ LCellSize
  15199. 26
  15200. PROCEDURE LCellSize (cSize: Point; lHandle: ListHandle);
  15201.  
  15202.     LCellSize sets the cellSize field in the list record to cSize and
  15203. updates the visible rectangle to contain cells of this size. This
  15204. command should be used only before any cells have been drawn.
  15205.  
  15206. \ LGetSelect
  15207. 26
  15208. FUNCTION LGetSelect (next: BOOLEAN; VAR theCell: Cell;
  15209.                     lHandle: ListHandle) : BOOLEAN;
  15210.  
  15211.     If next is FALSE, LGetSelect returns TRUE if the specified cell is
  15212. selected, or FALSE if not. If next is TRUE, LGetSelect returns in c the
  15213. cell coordinates of the next selected cell in the row that is greater
  15214. than or equal to theCell. If there are no more cells in the row, it
  15215. returns in theCell the cell coordinates of the next selected cell in the
  15216. next row. If there are no more rows, FALSE is returned.
  15217.  
  15218. \ LSetSelect
  15219. 26
  15220. PROCEDURE LSetSelect (setIt: BOOLEAN; theCell: Cell;
  15221.                         lHandle: ListHandle);
  15222.  
  15223.     If setIt is TRUE, LSetSelect selects the cell and redraws if it is
  15224. visible and was previously unselected. If setIt is FALSE, it deselects
  15225. the cell and redraws if necessary.
  15226.  
  15227. \ LClick
  15228. 26
  15229. FUNCTION LClick (pt: Point; modifiers: INTEGER; lHandle: ListHandle)
  15230.                     : BOOLEAN;
  15231.  
  15232.     Call LClick when there is a mouse-down event in the destination
  15233. rectangle or its scroll bars. Pt is the mouse location in local
  15234. coordinates. Modifiers is the modifiers word from the event record.
  15235. LHandle is the list to be tracked. The result is TRUE if a double-click
  15236. occurred (and the two clicks took place within the same cell).
  15237.  
  15238.     LClick keeps control until the mouse is released; each time through
  15239. its inner loop, it calls the routine whose pointer is in the lClikLoop
  15240. field of the list record.
  15241.  
  15242.     If the mouse is in the visible rectangle, cells are selected
  15243. according to the state of the modifiers and the selection flags. If the
  15244. mouse was in the cells but is dragged outside the list’s rectangle, the
  15245. list is auto-scrolled. If the mouse was in a control, the control’s
  15246. definition procedure is called to track the mouse. To discover which
  15247. cell was clicked in, use the LLastClick function.
  15248.  
  15249. \ LLastClick
  15250. 26
  15251. FUNCTION LLastClick (lHandle: ListHandle) : Cell;
  15252.  
  15253.     LLastClick returns the cell coordinates of the last cell clicked in.
  15254. If no cell has been clicked in since LNew, the value returned (for both
  15255. integers) is negative.
  15256.  
  15257. Note:   The value returned by this call is not the last cell
  15258.         double-clicked in, or the last cell selected, but merely the
  15259.         last cell clicked in.
  15260.  
  15261. \ LFind
  15262. 26
  15263. PROCEDURE LFind (VAR offset,len: INTEGER; theCell: Cell;
  15264.                     lHandle: ListHandle);
  15265.  
  15266.     Given a cell in theCell, LFind returns the offset and the length in
  15267. bytes of the cell’s data. If an invalid cell is specified, offset and
  15268. len are set to –1. A similar procedure, LGetCell, is more convenient to
  15269. use from Pascal.
  15270.  
  15271. \ LNextCell
  15272. 26
  15273. FUNCTION LNextCell (hNext,vNext: BOOLEAN; VAR theCell: Cell;
  15274.                     lHandle: ListHandle) : BOOLEAN;
  15275.  
  15276.     Given a cell in theCell, LNextCell returns in theCell the next cell
  15277. in the list. If both hNext and vNext are TRUE, theCell is first
  15278. advanced to the next cell in the row. If there are no more cells in the
  15279. row, theCell is set to the first cell in the next row. If there are no
  15280. more rows, FALSE is returned. If only hNext is TRUE, theCell is
  15281. advanced within the current row. If only vNext is TRUE, theCell is
  15282. advanced within the current column. FALSE is returned if there are no
  15283. remaining cells in the row or column.
  15284.  
  15285. \ LRect
  15286. 26
  15287. PROCEDURE LRect (VAR cellRect: Rect; theCell: Cell; lHandle: ListHandle)
  15288.  
  15289.     LRect returns in cellRect the local (QuickDraw) coordinates of the
  15290. cell specified by theCell. If an invalid cell is specified, (0,0)(0,0)
  15291. is returned in cellRect.
  15292.  
  15293. \ LSearch
  15294. 26
  15295. FUNCTION LSearch (dataPtr: Ptr; dataLen: INTEGER; searchProc: Ptr;
  15296.                     VAR theCell: Cell; lHandle: ListHandle) : BOOLEAN;
  15297.  
  15298.     LSearch searches for the first cell greater than or equal to theCell
  15299. that contains the specified data. If a cell containing matching data is
  15300. found, the function result TRUE is returned, and the cell coordinates
  15301. are returned in theCell. If searchProc is NIL, the International
  15302. Utilities Package function IUMagIDString is called to compare the
  15303. specified data with the contents of each cell. If searchProc is not
  15304. NIL, the routine pointed to by searchProc is called.
  15305.  
  15306. Note:  Your searchProc should have the same parameters as the
  15307.         IUMagIDString function.
  15308.  
  15309. \ LSize
  15310. 26
  15311. PROCEDURE LSize (listWidth,listHeight: INTEGER; lHandle: ListHandle);
  15312.  
  15313.     You’ll usually call LSize immediately after the Window Manager
  15314. procedure SizeWindow. It causes the bottom right of the list to be
  15315. adjusted so that the list is the width and height indicated by listWidth
  15316. and listHeight. The contents of the list and the scroll bars are
  15317. adjusted and redrawn as necessary. The values of listWidth and
  15318. listHeight do not include the scroll bars; for a list that entirely
  15319. fills the window, listWidth and listHeight should be 15 less than the
  15320. portRect if both scroll bars are present.
  15321.  
  15322. \ LDraw
  15323. 26
  15324. PROCEDURE LDraw (theCell: Cell; lHandle: ListHandle);
  15325.  
  15326.     Call LDraw after updating a cell’s data or selection status. (You
  15327. can achieve the same result by invalidating the cell’s rectangle and
  15328. calling LUpdate in response to the update event.)  The List Manager
  15329. makes its grafPort the current port, sets the clipping region to
  15330. the cell’s rectangle, and calls the list definition procedure to draw
  15331. the cell. It restores the clipping region and port before exiting.
  15332.  
  15333. \ LDoDraw
  15334. 26
  15335. PROCEDURE LDoDraw (drawIt: BOOLEAN; lHandle: ListHandle);
  15336.  
  15337.     LDoDraw sets the List Manager’s drawing mode to the state specified
  15338. by drawIt. If drawIt is TRUE, changes made by most List Manager calls
  15339. will cause some sort of drawing to take place. If drawIt is FALSE, all
  15340. cell drawing is disabled. (Two exceptions:  The scroll bars are still
  15341. updated after LSize, and the scroll arrows are still highlighted if the
  15342. user clicks them.)
  15343.  
  15344.     The recommended use of LDoDraw is to disable drawing while you’re
  15345. building a list (that is, adding rows or columns, setting or changing
  15346. cell values, or setting default selections). Once you’ve finished
  15347. building the list, you should then re-enable drawing. In general,
  15348. drawing should be on while you’re in your event loop and dispatching
  15349. events to the List Manager.
  15350.  
  15351. \ LScroll
  15352. 26
  15353. PROCEDURE LScroll (dCols,dRows: INTEGER; lHandle: ListHandle);
  15354.  
  15355.     LScroll scrolls the given list by the number of columns and rows
  15356. specified in dCols and dRows, either positively (down and to the right)
  15357. or negatively (up and to the left). Scrolling is pinned to the list’s
  15358. dataBounds. If drawing is on, LScroll does all necessary updating of
  15359. the screen.
  15360.  
  15361. \ LAutoScroll
  15362. 26
  15363. PROCEDURE LAutoScroll   (lHandle: ListHandle);
  15364.  
  15365.     For the given list, LAutoScroll scrolls the list until the first
  15366. selected cell is visible. It automatically places the first selected
  15367. cell in the top left corner of the visible rectangle.
  15368.  
  15369. \ LUpdate
  15370. 26
  15371. PROCEDURE LUpdate (theRgn: RgnHandle; lHandle: ListHandle);
  15372.  
  15373.     LUpdate should be called in response to an update event. TheRgn
  15374. should be set to the visRgn of the list’s port (for more details, see
  15375. the BeginUpdate procedure in the Window Manager chapter). It redraws
  15376. any visible cells in lHandle that intersect theRgn. It also redraws
  15377. the controls, if necessary.
  15378.  
  15379. \ LActivate
  15380. 26
  15381. PROCEDURE LActivate (act: BOOLEAN; lHandle: ListHandle);
  15382.  
  15383.     Call LActivate to activate or deactivate the list specified by
  15384. lHandle (in response to an activate event in the window containing the
  15385. list). The act parameter should be set to TRUE to activate the list, or
  15386. FALSE to deactivate the list. LActivate highlights or unhighlights the
  15387. selections, and shows or hides the scroll bars (but not the size box, if
  15388. any).